我目前正在研究环境变量对贝类毒性的影响。这种毒性仅在某些年份发生。我想比较有毒年和无毒年之间15种不同环境变量的时间序列。我的数据或10年和6个地点。 我希望 1个窗口/站点,每个窗口包含10个ggplots ,代表10个年度时间序列一个参数
以下是我在一个位置上为一个参数(温度)提供的可重现示例的数据:(已更正为可重现)
structure(list(Date = structure(c(12065, 12065, 12079, 12079,
12088, 12095, 12095, 12104, 12115, 12115, 12123, 12123, 12130,
12130, 12135, 12137, 12137, 12142, 12146, 12146, 12149, 12150,
12150, 12156, 12157, 12157, 12164, 12164, 12165, 12170, 12177,
12177, 12177, 12184, 12185, 12185, 12191, 12192, 12192, 12198,
12199, 12199, 12205, 12206, 12206, 12213, 12215, 12215, 12219,
12219, 12219, 12226, 12233, 12235, 12235, 12240, 12240, 12240,
12240, 12240, 12240, 12248, 12248, 12248, 12254, 12255, 12255,
12261, 12263, 12263, 12268, 12268, 12268, 12275, 12275, 12275,
12282, 12283, 12283, 12289, 12291, 12291, 12296, 12297, 12297,
12303, 12305, 12305, 12311, 12311, 12318, 12318, 12326, 12331,
12338, 12352, 12368, 12381, 12395, 12403, 12424, 12436, 12452,
12464, 12478, 12495, 12507, 12522, 12528, 12534, 12541, 12548,
12562, 12571, 12571, 12576, 12576, 12583, 12583, 12591, 12598,
12613, 12620, 12625, 12633, 12639, 12646, 12653, 12661, 12667,
12676, 12682, 12690, 12696, 12702, 12709, 12716, 12724, 12730,
12744, 12758, 12772, 12795, 12800, 12814, 12828, 12843, 12856,
12871, 12877, 12884, 12898, 12905, 12912, 12926, 12933, 12940,
12954, 12954, 12961, 12961, 12968, 12968, 12982, 12982, 13011,
13011, 13024, 13024, 13038, 13052, 13052, 13067, 13083, 13094,
13111, 13122, 13136, 13151, 13166, 13178, 13192, 13206, 13221,
13236, 13248, 13262, 13270, 13278, 13292, 13298, 13305, 13318,
13318, 13326, 13332, 13332, 13333, 13339, 13346, 13346, 13377,
13390, 13402, 13432, 13466, 13529, 13542, 13585, 13599, 13614,
13626, 13643, 13655, 13669, 13675, 13683, 13698, 13710, 13725,
13731, 13741, 13754, 13760, 13767, 13781, 13789, 13795, 13809,
13823, 13838, 13851, 13867, 13901, 13901, 13907, 13921, 13936,
13936, 13957, 13963, 13963, 13978, 13992, 13992, 14005, 14020,
14020, 14036, 14036, 14041, 14047, 14047, 14047, 14047, 14047,
14053, 14054, 14061, 14061, 14069, 14076, 14076, 14076, 14076,
14077, 14082, 14089, 14089, 14105, 14105, 14105, 14105, 14118,
14118, 14131, 14131, 14145, 14145, 14152, 14160, 14166, 14173,
14180, 14188, 14202, 14216, 14230, 14258, 14271, 14287, 14299,
14312, 14327, 14340, 14354, 14368, 14375, 14382, 14397, 14411,
14411, 14425, 14425, 14440, 14440, 14447, 14453, 14453, 14467,
14467, 14474, 14481, 14481, 14488, 14494, 14502, 14509, 14509,
14516, 14523, 14539, 14565, 14579, 14593, 14607, 14635, 14649,
14663, 14683, 14700, 14706, 14714, 14719, 14727, 14736, 14749,
14763, 14763, 14777, 14777, 14791, 14819, 14819, 14824, 14832,
14832, 14845, 14845, 14861, 14861, 14873, 14873, 14888, 14902,
14929, 14985, 14999, 15015, 15029, 15043, 15057, 15071, 15085,
15097, 15111, 15125, 15141, 15141, 15153, 15153, 15167, 15167,
15181, 15181, 15195, 15195, 15209, 15209, 15223, 15237, 15237,
15251, 15265, 15281, 15293, 15307, 15321, 15335, 15349, 15377,
15391, 15405, 15419, 15433, 15447, 15457, 15463, 15474, 15491,
15503, 15503, 15517, 15517, 15523, 15533, 15545, 15545, 15559,
15559, 15573, 15573, 15589, 15589, 15601, 15601, 15615, 15629,
15643, 15657, 15671, 15685, 15702), class = "Date"), Annee = structure(c(9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L), .Label = c("1995", "1996", "1997", "1998", "1999", "2000",
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008",
"2009", "2010", "2011", "2012", "2013"), class = "factor"), Mois = structure(c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L,
11L, 11L, 12L, 12L, 1L, 1L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L,
8L, 8L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 12L,
12L, 1L, 1L, 1L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L,
10L, 10L, 11L, 11L, 12L, 12L, 1L, 1L, 1L, 2L, 2L, 3L, 3L, 4L,
4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 8L,
8L, 9L, 10L, 11L, 1L, 1L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, 6L,
7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 11L, 11L,
12L, 12L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L,
9L, 9L, 10L, 10L, 10L, 10L, 11L, 11L, 12L, 12L, 1L, 1L, 2L, 2L,
3L, 3L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L,
7L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 11L,
12L, 12L, 12L, 1L, 2L, 2L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 6L,
6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 10L,
10L, 11L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L,
11L, 11L, 11L, 12L, 12L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 4L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L,
9L, 9L, 10L, 10L, 10L, 11L, 11L, 12L, 12L), .Label = c("01",
"02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
), class = "factor"), Jourannee = structure(c(12L, 12L, 26L,
26L, 35L, 42L, 42L, 51L, 62L, 62L, 70L, 70L, 77L, 77L, 82L, 84L,
84L, 89L, 93L, 93L, 96L, 97L, 97L, 103L, 104L, 104L, 111L, 111L,
112L, 117L, 124L, 124L, 124L, 131L, 132L, 132L, 138L, 139L, 139L,
145L, 146L, 146L, 152L, 153L, 153L, 160L, 162L, 162L, 166L, 166L,
166L, 173L, 180L, 182L, 182L, 187L, 187L, 187L, 187L, 187L, 187L,
195L, 195L, 195L, 201L, 202L, 202L, 208L, 210L, 210L, 215L, 215L,
215L, 222L, 222L, 222L, 229L, 230L, 230L, 236L, 238L, 238L, 243L,
244L, 244L, 250L, 252L, 252L, 258L, 258L, 265L, 265L, 273L, 278L,
285L, 299L, 314L, 327L, 341L, 349L, 6L, 18L, 34L, 46L, 60L, 77L,
89L, 104L, 110L, 116L, 123L, 130L, 144L, 153L, 153L, 158L, 158L,
165L, 165L, 173L, 180L, 195L, 202L, 207L, 215L, 221L, 228L, 235L,
243L, 249L, 258L, 264L, 272L, 278L, 284L, 291L, 298L, 306L, 312L,
325L, 339L, 353L, 11L, 16L, 30L, 44L, 59L, 72L, 87L, 93L, 100L,
114L, 121L, 128L, 142L, 149L, 156L, 170L, 170L, 177L, 177L, 184L,
184L, 198L, 198L, 227L, 227L, 240L, 240L, 254L, 268L, 268L, 283L,
299L, 310L, 326L, 337L, 351L, 2L, 17L, 29L, 43L, 57L, 72L, 87L,
99L, 113L, 121L, 129L, 143L, 149L, 156L, 169L, 169L, 177L, 183L,
183L, 184L, 190L, 197L, 197L, 228L, 241L, 253L, 283L, 316L, 15L,
28L, 71L, 85L, 100L, 112L, 129L, 141L, 155L, 161L, 169L, 184L,
196L, 211L, 217L, 227L, 240L, 246L, 253L, 267L, 275L, 281L, 295L,
309L, 323L, 336L, 352L, 22L, 22L, 28L, 42L, 57L, 57L, 78L, 84L,
84L, 99L, 113L, 113L, 126L, 141L, 141L, 157L, 157L, 162L, 168L,
168L, 168L, 168L, 168L, 174L, 175L, 182L, 182L, 190L, 197L, 197L,
197L, 197L, 198L, 203L, 210L, 210L, 226L, 226L, 226L, 226L, 239L,
239L, 252L, 252L, 266L, 266L, 273L, 281L, 287L, 294L, 301L, 309L,
322L, 336L, 350L, 13L, 26L, 42L, 54L, 67L, 82L, 95L, 109L, 123L,
130L, 137L, 152L, 166L, 166L, 180L, 180L, 195L, 195L, 202L, 208L,
208L, 222L, 222L, 229L, 236L, 236L, 243L, 249L, 257L, 264L, 264L,
271L, 278L, 294L, 319L, 333L, 347L, 360L, 25L, 39L, 53L, 73L,
90L, 96L, 104L, 109L, 117L, 126L, 139L, 153L, 153L, 167L, 167L,
181L, 209L, 209L, 214L, 222L, 222L, 235L, 235L, 251L, 251L, 263L,
263L, 278L, 292L, 318L, 10L, 24L, 40L, 54L, 68L, 82L, 96L, 110L,
122L, 136L, 150L, 166L, 166L, 178L, 178L, 192L, 192L, 206L, 206L,
220L, 220L, 234L, 234L, 248L, 262L, 262L, 276L, 290L, 306L, 317L,
331L, 345L, 358L, 9L, 37L, 51L, 65L, 79L, 93L, 107L, 117L, 123L,
134L, 151L, 163L, 163L, 177L, 177L, 183L, 193L, 205L, 205L, 219L,
219L, 233L, 233L, 249L, 249L, 261L, 261L, 275L, 289L, 303L, 316L,
330L, 344L, 360L), .Label = c("002", "003", "004", "005", "006",
"007", "008", "009", "010", "011", "012", "013", "014", "015",
"016", "017", "018", "019", "020", "021", "022", "023", "024",
"025", "026", "027", "028", "029", "030", "031", "032", "033",
"034", "035", "036", "037", "038", "039", "040", "041", "042",
"043", "044", "045", "046", "047", "048", "049", "050", "051",
"052", "053", "054", "055", "056", "057", "058", "059", "060",
"061", "062", "063", "064", "065", "066", "067", "068", "069",
"070", "071", "072", "073", "074", "075", "076", "077", "078",
"079", "080", "081", "082", "083", "084", "085", "086", "087",
"088", "089", "090", "091", "092", "093", "094", "095", "096",
"097", "098", "099", "100", "101", "102", "103", "104", "105",
"106", "107", "108", "109", "110", "111", "112", "113", "114",
"115", "116", "117", "118", "119", "120", "121", "122", "123",
"124", "125", "126", "127", "128", "129", "130", "131", "132",
"133", "134", "135", "136", "137", "138", "139", "140", "141",
"142", "143", "144", "145", "146", "147", "148", "149", "150",
"151", "152", "153", "154", "155", "156", "157", "158", "159",
"160", "161", "162", "163", "164", "165", "166", "167", "168",
"169", "170", "171", "172", "173", "174", "175", "176", "177",
"178", "179", "180", "181", "182", "183", "184", "185", "186",
"187", "188", "189", "190", "191", "192", "193", "194", "195",
"196", "197", "198", "199", "200", "201", "202", "203", "204",
"205", "206", "207", "208", "209", "210", "211", "212", "213",
"214", "215", "216", "217", "218", "219", "220", "221", "222",
"223", "224", "225", "226", "227", "228", "229", "230", "231",
"232", "233", "234", "235", "236", "237", "238", "239", "240",
"241", "242", "243", "244", "245", "246", "247", "248", "249",
"250", "251", "252", "253", "254", "255", "256", "257", "258",
"259", "260", "261", "262", "263", "264", "265", "266", "267",
"268", "269", "270", "271", "272", "273", "274", "275", "276",
"277", "278", "279", "280", "281", "282", "283", "284", "285",
"286", "287", "288", "289", "290", "291", "292", "293", "294",
"295", "296", "297", "298", "299", "300", "301", "302", "303",
"304", "305", "306", "307", "308", "309", "310", "311", "312",
"313", "314", "316", "317", "318", "319", "320", "321", "322",
"323", "324", "325", "326", "327", "328", "329", "330", "331",
"332", "333", "334", "335", "336", "337", "338", "339", "340",
"341", "342", "343", "344", "345", "346", "347", "348", "349",
"350", "351", "352", "353", "354", "355", "356", "357", "358",
"360", "361", "362", "363", "364", "365"), class = "factor"),
Mesure = c(8, 8, 9.5, 10, 9.5, 10.7, 10.7, 8.5, 9.8, 9.8,
10.3, 10.5, 10.4, 10.5, 11.7, 10.6, 10.6, 13.6, 11.1, 11.1,
11.4, 11, 11, 13, 11.3, 11.3, 12.8, 13.8, 14.4, 14.5, 13.5,
13.9, 15.1, 13.8, 12.5, 12.6, 13.4, 12.6, 12.6, 15, 14.1,
14.3, 17.1, 14.7, 14.9, 18.6, 19, 20, 18.8, 19.2, 19.3, 18.9,
17.7, 15.9, 16.2, 14.2, 14.7, 14.9, 15.3, 15.3, 16, 18.4,
18.4, 20, 20.4, 17.8, 17.8, 19.2, 17.5, 17.7, 17.6, 17.7,
21.3, 22.2, 22.2, 22.6, 20.9, 19.2, 20.2, 21.1, 19.7, 19.7,
18, 17.6, 18.9, 18.7, 16.9, 17.8, 17.2, 18.1, 17.6, 18.9,
17, 16.9, 15, 14.1, 13, 12.6, 11.7, 11, 10.7, 10.3, 10.4,
9.5, 8.2, 8.9, 10.1, 10.8, 10.9, 12.8, 13.1, 12.1, 14.8,
14.2, 17, 17.6, 17.8, 14.1, 17.7, 14.7, 14.7, 14.2, 15.3,
17.8, 18, 19.8, 18.3, 19.4, 16.9, 19, 17.6, 17.4, 16.4, 16.4,
15.8, 15.1, 14.8, 14.1, 14.2, 12.8, 12, 10.3, 10.7, 10.2,
9.7, 9.4, 7.7, 8, 11, 11.4, 10.7, 12, 13.1, 12.7, 14.3, 15.6,
14.7, 15, 18.5, 17.2, 19.3, 12.8, 15, 15, 17.7, 14.9, 17.3,
15.6, 16.6, 18.5, 16.4, 17.3, 16.4, 16.2, 15.1, 12.7, 10,
8.3, 7.3, 7, 8, 7.4, 7.4, 8.4, 9.2, 9.4, 12.7, 11.5, 14.2,
12.7, 12.5, 15.7, 17.8, 18.9, 17.4, 16.6, 18.7, 20.7, 20,
18, 18.9, 15.7, 16.1, 18.1, 17.6, 14.7, 12.1, 11, 11.8, 11,
12.4, 14.5, 12.7, 12.6, 14.4, 17.9, 16.6, 14.5, 16.2, 17.1,
18.7, 17.9, 17.4, 17.2, 18, 16.4, 14.4, 15.5, 14.2, 13.8,
12.1, 11.3, 8.9, 9.8, 9.8, 8.9, 8.4, 8.9, 8.9, 10.6, 10.2,
10.2, 10.8, 11.7, 11.7, 14, 16.2, 16.2, 14, 15, 15.6, 12.9,
12.9, 15, 15.7, 15.7, 16.6, 17.4, 12.9, 16.9, 15.5, 13.9,
13.9, 16.1, 16.1, 14.6, 14.1, 18, 18.6, 12.4, 12.4, 15.4,
15.4, 15.8, 17.2, 16.5, 16.5, 16.7, 16.8, 15.9, 14.3, 15.4,
15, 13.3, 13.2, 12.7, 11.4, 9.4, 6.9, 8.2, 8.4, 8.2, 9.5,
11.1, 11, 12.8, 12, 12.3, 13, 16.6, 13.5, 16.7, 14.2, 19.3,
13.7, 16.1, 14.2, 14.1, 17.2, 15, 17.3, 19.5, 16.2, 18.1,
17.4, 15.4, 16.9, 14.7, 16.6, 17.2, 16.6, 15.4, 11.8, 11.8,
10.2, 10, 7.1, 8.3, 8.2, 8, 9.8, 10.2, 12.1, 11.7, 13.4,
11.2, 13.1, 10.6, 13.2, 12.9, 14.6, 18, 12.7, 15.1, 16.3,
11.9, 15.7, 14.6, 17, 15.2, 17.5, 15, 16.3, 15.5, 15.7, 13,
7.7, 7.9, 8.4, 9.2, 8.7, 10, 12.1, 13.6, 15.3, 14.89, 13.05,
13.8, 14.89, 14.9, 16.41, 16.1, 16.39, 11.7, 14.8, 15.56,
16.72, 17, 18.07, 17.4, 15, 16.79, 18.27, 16.39, 15.6, 14.75,
13.87, 12.2, 11, 11.8, 9.71, 9.52, 10.47, 11.44, 12.05, 11.49,
11.6, 12.83, 14.05, 17.14, 12.6, 14.8, 12.6, 15.16, 16.1,
15.32, 16.8, 18.01, 15.5, 16.65, 18.8, 20.36, 16.8, 17.52,
15.6, 17.35, 15.8, 15.62, 14.86, 13.2, 12.11, 11.65, 12)), .Names = c("Date",
"Annee", "Mois", "Jourannee", "Mesure"), class = "data.frame", row.names = c("7413",
"7440", "16263", "19364", "16266", "22684", "22705", "9711",
"18115", "18133", "20630", "21431", "21054", "21437", "26379",
"22192", "22243", "34022", "24087", "24124", "25291", "23623",
"23663", "31760", "24950", "24959", "31098", "34997", "37850",
"38311", "33673", "35459", "40853", "34839", "29922", "30310",
"33231", "30314", "30326", "40496", "36427", "37419", "53855",
"39326", "40145", "64409", "69950", "81748", "66481", "72995",
"74404", "68002", "58822", "45098", "47124", "36883", "39239",
"40140", "41558", "41600", "45858", "63000", "63005", "81502",
"84446", "59280", "59288", "72676", "57414", "58961", "58115",
"58991", "89667", "91764", "91768", "92261", "87505", "72951",
"83212", "88778", "78851", "78893", "60137", "58123", "68201",
"65525", "52759", "59289", "55419", "61881", "58154", "68003",
"53356", "52695", "40657", "36449", "31885", "30332", "26459",
"23669", "22574", "20511", "20903", "16118", "8086", "12079",
"19751", "22853", "23163", "30939", "32157", "27887", "39661",
"36753", "53067", "57893", "59172", "36321", "58700", "39167",
"39170", "36734", "41402", "59170", "59903", "79538", "62765",
"75136", "52653", "69435", "57897", "56565", "48945", "48951",
"44503", "40840", "39670", "36315", "36742", "30945", "27506",
"20514", "22577", "20126", "17341", "15719", "6445", "7337",
"23464", "25247", "22580", "27509", "32163", "30559", "37312",
"43405", "39176", "40414", "63157", "54854", "74032", "30952",
"40404", "40417", "58699", "40005", "56083", "43409", "51235",
"63154", "49001", "56088", "48939", "46903", "40834", "30548",
"19184", "8756", "4488", "3263", "7334", "5070", "5079", "9252",
"14404", "15713", "30545", "25632", "36722", "30554", "29683",
"44042", "59178", "67753", "56643", "51255", "65461", "86321",
"81509", "59912", "67781", "44028", "46318", "61761", "57905",
"39173", "27890", "23455", "26624", "23461", "29204", "38270",
"30556", "30171", "37778", "59417", "51253", "38275", "46909",
"53720", "65458", "59418", "56588", "55061", "59906", "48962",
"37783", "42312", "36729", "34791", "27881", "24836", "12045",
"17979", "17984", "12054", "9250", "12064", "12072", "22002",
"20109", "20110", "22851", "26337", "26343", "35822", "46898",
"46901", "35832", "40398", "43545", "31363", "31366", "40409",
"44036", "44039", "51229", "56644", "31360", "52652", "42381",
"35285", "35288", "46301", "46304", "38784", "36367", "59915",
"64162", "29209", "29214", "41856", "41859", "44511", "54826",
"50116", "50123", "51750", "52291", "45044", "37307", "41911",
"40401", "32853", "32456", "30551", "25244", "15716", "3183",
"8084", "9255", "8088", "16121", "24000", "23451", "30942", "27499",
"28718", "31659", "51239", "33546", "51749", "36763", "74022",
"34331", "46314", "36739", "36327", "54836", "40426", "56091",
"76239", "46918", "61765", "56576", "41862", "52655", "39178",
"51245", "54846", "51252", "41865", "26627", "26633", "20111",
"19192", "3458", "8753", "8082", "7331", "18038", "20116", "27951",
"26348", "33149", "24365", "32151", "22014", "32459", "31371",
"38781", "59900", "30563", "40837", "47885", "27080", "44045",
"38786", "53065", "41042", "57129", "40420", "47846", "42315",
"44048", "31656", "6442", "7052", "9258", "14410", "10555", "19188",
"27884", "33979", "41399", "39928", "32069", "34796", "39931",
"40008", "49774", "46321", "48767", "26353", "39665", "43246",
"52091", "53071", "61427", "56562", "40428", "52180", "62728",
"48774", "43399", "39575", "35204", "28221", "23458", "26637",
"17853", "16513", "21209", "25556", "27842", "25597", "25991",
"31297", "36208", "54390", "30174", "39673", "30177", "41010",
"46309", "41781", "52294", "61206", "42318", "51654", "66398",
"84164", "52298", "57710", "43416", "56444", "44500", "43880",
"39901", "32468", "28144", "26261", "27515"))
这是我程序的摘录
p<-list()
#Creating the graphs year by year
for(a in 1: 10){
#selecting the year
An<-baie[baie$Annee==unique(baie$Annee)[a],]
moyparam<-ddply(An, .(Date, Annee, Mois, Jourannee), function(x) data.frame(Mesure=mean(x$Mesure)))
p[[a]]<-ggplot(data=moyparam, aes(x=moyparam$Date, y=moyparam$Mesure))+geom_point()+theme_bw()
}
grid.arrange(p)
#or
multiplot(plotlist=p, layout=matrix(c(1:10),nrow=2,ncol=5, byrow=TRUE))
我设法分别绘制每个图形,它们甚至存储在列表中,但是当我显示列表或当我尝试进行多个绘图时,我收到一条消息:
data.frame中的错误(x = c(15349,15365,15377,15392,15411,15412, 15419,:参数意味着行数不同
我哪里错了?也许答案很简单,但我想我可以对问题采用新的观点。 谢谢你能给我的任何帮助。
作为更新: 感谢Roland和诺亚指出我的错误并快速帮助我!但这是一个精确度:
我以前没有提到它,但我的代码比这里写的要复杂一些。实际上,我在“风险期”上添加了部分着色的背景,仅在观察到毒性的年份(因此我可以比较有毒年份(确切地说:在风险期)和无毒年份(在整个年)。 所以我的代码正在测试年份是否有毒,如果是,它会在风险期间添加颜色背景。我没有把它放在前,因为即使没有这个测试我的错误也会发生,我现在提到它因为它解释了为什么我不能使用facet网格(或者我可以吗?有没有办法可以在某些方面添加部分彩色背景?)
答案 0 :(得分:2)
如果您更正了在aes()中滥用$
的错误,则代码会按预期运行,
p[[a]] <- ggplot(data=moyparam, aes(x=Date, y=Mesure)) +
geom_point()+theme_bw()
这是一种更简洁的处理方式:
baie2 = plyr::ddply(baie, .(Date, Annee, Mois, Jourannee),
summarise, Mesure = mean(Mesure))
base_plot = ggplot(baie2, aes(x=Date, y=Mesure)) + geom_point()+theme_bw()
lp = plyr::dlply(baie2, "Annee", `%+%`, e1 = base_plot)
您可以在其中安排页面中的所有图表:
gridExtra::grid.arrange(grobs = lp)
现在,对于更广泛的问题,您有两种选择:
使用年份的分面,并使用循环/ **层为每个网站打开新页面
base_plot + facet_wrap(~Annee, scales="free")
使用gridExtra::marrangeGrob
,就像上面的grid.arrange一样,但如有必要,会自动将布局拆分为多个页面。它也适用于ggsave。