creating a line plot for time series data for several years

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

creating a line plot for time series data for several years

Marna Wagley
Hi R Users,
I have been getting a trouble to create a time series plot (line) as I was
trying to create a line graph for each year using month and date (in x
axis). I would like to put only one x axis (month and date) for three years
using the facet_grid, but it has not been creating a lineplot for me. I
wanted to compare (visually) whether  the date of observing of the
population vary by year.
I used the following code but did not plot for me any line. Is there any
possibility to create the lines for each year? A sample of the data is
given for your information.

daT$DATE<-format(as.Date(daT$date), format="%m/%d")
Ab<-ggplot(daT, aes(x= as.factor(DATE), y=abundance, colour=site)) +
    geom_line() +
    theme_bw()
Ab+facet_grid(year~.)+theme(axis.text.x = element_text(angle = 90, hjust =
1, size=4))
###

daT<-structure(list(year = c(2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
2018L, 2018L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
2016L), date = structure(c(231L, 232L, 233L, 234L, 235L, 236L,
237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L,
248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L,
259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L, 269L,
270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L, 280L,
281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L, 290L, 291L,
292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L, 300L, 301L, 302L,
303L, 304L, 305L, 306L, 307L, 308L, 309L, 310L, 311L, 312L, 313L,
314L, 315L, 316L, 317L, 318L, 319L, 320L, 321L, 322L, 323L, 324L,
325L, 326L, 327L, 328L, 118L, 119L, 120L, 121L, 122L, 123L, 124L,
125L, 126L, 127L, 128L, 129L, 130L, 131L, 131L, 132L, 132L, 133L,
133L, 134L, 135L, 135L, 136L, 136L, 137L, 138L, 138L, 139L, 140L,
141L, 142L, 143L, 144L, 145L, 146L, 146L, 147L, 148L, 149L, 150L,
151L, 152L, 153L, 154L, 155L, 156L, 157L, 157L, 158L, 158L, 159L,
159L, 160L, 160L, 161L, 162L, 163L, 164L, 164L, 165L, 165L, 166L,
166L, 167L, 167L, 168L, 168L, 169L, 170L, 170L, 171L, 171L, 172L,
172L, 173L, 173L, 174L, 174L, 175L, 175L, 176L, 176L, 177L, 178L,
178L, 179L, 179L, 180L, 180L, 181L, 182L, 183L, 183L, 184L, 184L,
185L, 186L, 187L, 188L, 188L, 189L, 190L, 190L, 191L, 191L, 192L,
193L, 194L, 195L, 195L, 196L, 196L, 197L, 197L, 198L, 198L, 199L,
199L, 200L, 201L, 201L, 202L, 203L, 203L, 204L, 205L, 206L, 207L,
208L, 209L, 210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L,
219L, 220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
230L, 230L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 9L, 10L, 11L,
12L, 12L, 13L, 13L, 14L, 14L, 15L, 16L, 16L, 17L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 27L, 28L, 28L, 29L, 30L,
31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 38L, 39L, 40L, 40L, 41L,
41L, 42L, 43L, 44L, 45L, 46L, 47L, 47L, 48L, 49L, 50L, 51L, 52L,
52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 59L, 60L, 61L, 62L, 63L,
63L, 64L, 65L, 66L, 67L, 68L, 68L, 69L, 70L, 71L, 72L, 72L, 73L,
73L, 74L, 74L, 75L, 76L, 76L, 77L, 78L, 78L, 79L, 80L, 81L, 82L,
83L, 84L, 85L, 85L, 86L, 87L, 87L, 88L, 89L, 90L, 91L, 92L, 92L,
93L, 94L, 94L, 95L, 96L, 96L, 97L, 98L, 98L, 99L, 100L, 100L,
101L, 101L, 102L, 102L, 103L, 104L, 104L, 105L, 106L, 106L, 107L,
107L, 108L, 109L, 110L, 110L, 111L, 111L, 112L, 113L, 114L, 114L,
115L, 116L, 117L), .Label = c("2016-06-01", "2016-06-06", "2016-06-12",
"2016-06-14", "2016-06-16", "2016-06-17", "2016-06-18", "2016-06-19",
"2016-06-21", "2016-06-22", "2016-06-23", "2016-06-24", "2016-06-26",
"2016-06-27", "2016-06-28", "2016-06-30", "2016-07-01", "2016-07-03",
"2016-07-05", "2016-07-07", "2016-07-08", "2016-07-09", "2016-07-11",
"2016-07-12", "2016-07-14", "2016-07-16", "2016-07-17", "2016-07-18",
"2016-07-19", "2016-07-20", "2016-07-21", "2016-07-22", "2016-07-23",
"2016-07-25", "2016-07-26", "2016-07-27", "2016-07-28", "2016-07-29",
"2016-07-30", "2016-08-01", "2016-08-02", "2016-08-03", "2016-08-04",
"2016-08-05", "2016-08-06", "2016-08-07", "2016-08-08", "2016-08-09",
"2016-08-10", "2016-08-11", "2016-08-12", "2016-08-13", "2016-08-14",
"2016-08-15", "2016-08-16", "2016-08-18", "2016-08-19", "2016-08-20",
"2016-08-21", "2016-08-25", "2016-08-26", "2016-08-28", "2016-09-02",
"2016-09-04", "2016-09-05", "2016-09-06", "2016-09-07", "2016-09-08",
"2016-09-09", "2016-09-10", "2016-09-11", "2016-09-12", "2016-09-13",
"2016-09-14", "2016-09-17", "2016-09-18", "2016-09-19", "2016-09-20",
"2016-09-23", "2016-09-24", "2016-09-26", "2016-09-27", "2016-09-28",
"2016-09-29", "2016-09-30", "2016-10-02", "2016-10-03", "2016-10-04",
"2016-10-05", "2016-10-06", "2016-10-08", "2016-10-09", "2016-10-11",
"2016-10-12", "2016-10-13", "2016-10-14", "2016-10-15", "2016-10-16",
"2016-10-18", "2016-10-19", "2016-10-20", "2016-10-21", "2016-10-22",
"2016-10-23", "2016-10-24", "2016-10-25", "2016-10-27", "2016-10-28",
"2016-10-29", "2016-10-30", "2016-10-31", "2016-11-01", "2016-11-02",
"2016-11-07", "2016-11-17", "2016-11-25", "2016-11-27", "2017-06-19",
"2017-07-06", "2017-07-08", "2017-07-12", "2017-07-17", "2017-07-18",
"2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24",
"2017-07-25", "2017-07-26", "2017-07-27", "2017-07-29", "2017-07-31",
"2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05",
"2017-08-07", "2017-08-09", "2017-08-10", "2017-08-13", "2017-08-15",
"2017-08-16", "2017-08-17", "2017-08-18", "2017-08-20", "2017-08-24",
"2017-08-25", "2017-08-26", "2017-08-28", "2017-08-29", "2017-09-03",
"2017-09-04", "2017-09-06", "2017-09-08", "2017-09-10", "2017-09-11",
"2017-09-12", "2017-09-14", "2017-09-15", "2017-09-16", "2017-09-17",
"2017-09-18", "2017-09-19", "2017-09-21", "2017-09-22", "2017-09-23",
"2017-09-24", "2017-09-25", "2017-09-26", "2017-09-27", "2017-09-28",
"2017-09-29", "2017-09-30", "2017-10-01", "2017-10-02", "2017-10-03",
"2017-10-04", "2017-10-06", "2017-10-07", "2017-10-08", "2017-10-10",
"2017-10-11", "2017-10-12", "2017-10-14", "2017-10-15", "2017-10-16",
"2017-10-19", "2017-10-20", "2017-10-22", "2017-10-23", "2017-10-24",
"2017-10-25", "2017-10-26", "2017-10-27", "2017-10-28", "2017-10-29",
"2017-10-30", "2017-10-31", "2017-11-01", "2017-11-02", "2017-11-03",
"2017-11-04", "2017-11-05", "2017-11-06", "2017-11-07", "2017-11-09",
"2017-11-10", "2017-11-11", "2017-11-13", "2017-11-16", "2017-11-17",
"2017-11-21", "2017-11-22", "2017-11-23", "2017-11-27", "2017-11-28",
"2017-11-29", "2017-11-30", "2017-12-02", "2017-12-03", "2017-12-05",
"2017-12-09", "2017-12-10", "2017-12-11", "2017-12-13", "2017-12-14",
"2017-12-20", "2017-12-21", "2018-07-03", "2018-07-06", "2018-07-07",
"2018-07-08", "2018-07-09", "2018-07-10", "2018-07-11", "2018-07-12",
"2018-07-13", "2018-07-14", "2018-07-16", "2018-07-18", "2018-07-19",
"2018-07-20", "2018-07-21", "2018-07-22", "2018-07-24", "2018-07-25",
"2018-07-26", "2018-07-27", "2018-07-28", "2018-07-29", "2018-07-30",
"2018-07-31", "2018-08-01", "2018-08-02", "2018-08-03", "2018-08-04",
"2018-08-05", "2018-08-07", "2018-08-08", "2018-08-09", "2018-08-10",
"2018-08-11", "2018-08-12", "2018-08-13", "2018-08-14", "2018-08-15",
"2018-08-16", "2018-08-17", "2018-08-18", "2018-08-20", "2018-08-24",
"2018-08-26", "2018-08-27", "2018-08-28", "2018-08-29", "2018-08-30",
"2018-08-31", "2018-09-02", "2018-09-03", "2018-09-04", "2018-09-05",
"2018-09-06", "2018-09-07", "2018-09-08", "2018-09-09", "2018-09-10",
"2018-09-11", "2018-09-12", "2018-09-13", "2018-09-14", "2018-09-15",
"2018-09-17", "2018-09-18", "2018-09-19", "2018-09-20", "2018-09-21",
"2018-09-22", "2018-09-23", "2018-09-24", "2018-09-26", "2018-09-27",
"2018-09-28", "2018-09-29", "2018-09-30", "2018-10-01", "2018-10-02",
"2018-10-03", "2018-10-05", "2018-10-06", "2018-10-08", "2018-10-09",
"2018-10-10", "2018-10-12", "2018-10-13", "2018-10-14", "2018-10-17",
"2018-10-18", "2018-10-19", "2018-10-22", "2018-10-27", "2018-10-28",
"2018-10-29", "2018-11-01", "2018-11-03", "2018-11-04", "2018-11-05"
), class = "factor"), abundance = c(0, 2, 5, 6, 6, 7, 7, 7, 7,
9, 11, 13, 13, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 22,
23, 24, 25, 29, 31, 32, 34, 36, 36, 37, 37, 38, 39, 40, 40, 40,
40, 40, 41, 41, 41, 44, 44, 44, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 1, 2, 2, 2, 3, 4, 5, 6, 6,
6, 7, 9, 10, 11, 12, 14, 14, 15, 15, 16, 18, 19, 21, 22, 24,
25, 25, 26, 27, 28, 29, 30, 31, 31, 33, 33, 35, 36, 37, 38, 39,
40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0,
1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 10, 10, 10, 10,
11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 16, 18, 19,
20, 21, 21, 21, 21, 21, 24, 25, 26, 28, 29, 31, 32, 33, 34, 35,
35, 35, 36, 36, 37, 39, 41, 42, 42, 43, 43, 43, 44, 44, 45, 47,
47, 47, 47, 48, 49, 49, 50, 50, 50, 50, 50, 50, 51, 52, 52, 52,
52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55), DATE = c("07/03", "07/06", "07/07", "07/08",
"07/09", "07/10", "07/11", "07/12", "07/13", "07/14", "07/16",
"07/18", "07/19", "07/20", "07/21", "07/22", "07/24", "07/25",
"07/26", "07/27", "07/28", "07/29", "07/30", "07/31", "08/01",
"08/02", "08/03", "08/04", "08/05", "08/07", "08/08", "08/09",
"08/10", "08/11", "08/12", "08/13", "08/14", "08/15", "08/16",
"08/17", "08/18", "08/20", "08/24", "08/26", "08/27", "08/28",
"08/29", "08/30", "08/31", "09/02", "09/03", "09/04", "09/05",
"09/06", "09/07", "09/08", "09/09", "09/10", "09/11", "09/12",
"09/13", "09/14", "09/15", "09/17", "09/18", "09/19", "09/20",
"09/21", "09/22", "09/23", "09/24", "09/26", "09/27", "09/28",
"09/29", "09/30", "10/01", "10/02", "10/03", "10/05", "10/06",
"10/08", "10/09", "10/10", "10/12", "10/13", "10/14", "10/17",
"10/18", "10/19", "10/22", "10/27", "10/28", "10/29", "11/01",
"11/03", "11/04", "11/05", "06/19", "07/06", "07/08", "07/12",
"07/17", "07/18", "07/20", "07/21", "07/22", "07/23", "07/24",
"07/25", "07/26", "07/27", "07/27", "07/29", "07/29", "07/31",
"07/31", "08/01", "08/02", "08/02", "08/03", "08/03", "08/04",
"08/05", "08/05", "08/07", "08/09", "08/10", "08/13", "08/15",
"08/16", "08/17", "08/18", "08/18", "08/20", "08/24", "08/25",
"08/26", "08/28", "08/29", "09/03", "09/04", "09/06", "09/08",
"09/10", "09/10", "09/11", "09/11", "09/12", "09/12", "09/14",
"09/14", "09/15", "09/16", "09/17", "09/18", "09/18", "09/19",
"09/19", "09/21", "09/21", "09/22", "09/22", "09/23", "09/23",
"09/24", "09/25", "09/25", "09/26", "09/26", "09/27", "09/27",
"09/28", "09/28", "09/29", "09/29", "09/30", "09/30", "10/01",
"10/01", "10/02", "10/03", "10/03", "10/04", "10/04", "10/06",
"10/06", "10/07", "10/08", "10/10", "10/10", "10/11", "10/11",
"10/12", "10/14", "10/15", "10/16", "10/16", "10/19", "10/20",
"10/20", "10/22", "10/22", "10/23", "10/24", "10/25", "10/26",
"10/26", "10/27", "10/27", "10/28", "10/28", "10/29", "10/29",
"10/30", "10/30", "10/31", "11/01", "11/01", "11/02", "11/03",
"11/03", "11/04", "11/05", "11/06", "11/07", "11/09", "11/10",
"11/11", "11/13", "11/16", "11/17", "11/21", "11/22", "11/23",
"11/27", "11/28", "11/29", "11/30", "12/02", "12/03", "12/05",
"12/09", "12/10", "12/11", "12/13", "12/14", "12/20", "12/21",
"12/21", "06/01", "06/06", "06/12", "06/14", "06/16", "06/17",
"06/18", "06/19", "06/21", "06/21", "06/22", "06/23", "06/24",
"06/24", "06/26", "06/26", "06/27", "06/27", "06/28", "06/30",
"06/30", "07/01", "07/01", "07/03", "07/05", "07/07", "07/08",
"07/09", "07/11", "07/12", "07/14", "07/16", "07/17", "07/17",
"07/18", "07/18", "07/19", "07/20", "07/21", "07/22", "07/23",
"07/25", "07/26", "07/27", "07/28", "07/29", "07/29", "07/30",
"08/01", "08/01", "08/02", "08/02", "08/03", "08/04", "08/05",
"08/06", "08/07", "08/08", "08/08", "08/09", "08/10", "08/11",
"08/12", "08/13", "08/13", "08/14", "08/15", "08/16", "08/18",
"08/19", "08/20", "08/21", "08/21", "08/25", "08/26", "08/28",
"09/02", "09/02", "09/04", "09/05", "09/06", "09/07", "09/08",
"09/08", "09/09", "09/10", "09/11", "09/12", "09/12", "09/13",
"09/13", "09/14", "09/14", "09/17", "09/18", "09/18", "09/19",
"09/20", "09/20", "09/23", "09/24", "09/26", "09/27", "09/28",
"09/29", "09/30", "09/30", "10/02", "10/03", "10/03", "10/04",
"10/05", "10/06", "10/08", "10/09", "10/09", "10/11", "10/12",
"10/12", "10/13", "10/14", "10/14", "10/15", "10/16", "10/16",
"10/18", "10/19", "10/19", "10/20", "10/20", "10/21", "10/21",
"10/22", "10/23", "10/23", "10/24", "10/25", "10/25", "10/27",
"10/27", "10/28", "10/29", "10/30", "10/30", "10/31", "10/31",
"11/01", "11/02", "11/07", "11/07", "11/17", "11/25", "11/27"
), site = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A")), .Names = c("year", "date", "abundance", "DATE",
"site"), row.names = c(NA, 403L), class = "data.frame")

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: creating a line plot for time series data for several years

Rui Barradas
Hello,

Thanks for the reproducible example.
All you have to do is to use the aesthetic group = year in either
ggplot() or geom_line().

This works:


library(ggplot2)

daT$date <- as.Date(daT$date)
daT$DATE <- format(daT$date, format="%m/%d")

Ab <- ggplot(daT, aes(x = as.factor(DATE),
                       y = abundance, colour = site)) +
   geom_line(aes(group = year)) +
   theme_bw()

Ab + facet_grid(year ~ .) +
   theme(axis.text.x = element_text(angle = 90,
                                    hjust = 1,
                                    size = 4))


Hope this helps,

Rui Barradas

Às 21:37 de 04/09/19, Marna Wagley escreveu:

> Hi R Users,
> I have been getting a trouble to create a time series plot (line) as I was
> trying to create a line graph for each year using month and date (in x
> axis). I would like to put only one x axis (month and date) for three years
> using the facet_grid, but it has not been creating a lineplot for me. I
> wanted to compare (visually) whether  the date of observing of the
> population vary by year.
> I used the following code but did not plot for me any line. Is there any
> possibility to create the lines for each year? A sample of the data is
> given for your information.
>
> daT$DATE<-format(as.Date(daT$date), format="%m/%d")
> Ab<-ggplot(daT, aes(x= as.factor(DATE), y=abundance, colour=site)) +
>      geom_line() +
>      theme_bw()
> Ab+facet_grid(year~.)+theme(axis.text.x = element_text(angle = 90, hjust =
> 1, size=4))
> ###
>
> daT<-structure(list(year = c(2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> 2018L, 2018L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> 2017L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> 2016L), date = structure(c(231L, 232L, 233L, 234L, 235L, 236L,
> 237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L,
> 248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L,
> 259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L, 269L,
> 270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L, 280L,
> 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L, 290L, 291L,
> 292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L, 300L, 301L, 302L,
> 303L, 304L, 305L, 306L, 307L, 308L, 309L, 310L, 311L, 312L, 313L,
> 314L, 315L, 316L, 317L, 318L, 319L, 320L, 321L, 322L, 323L, 324L,
> 325L, 326L, 327L, 328L, 118L, 119L, 120L, 121L, 122L, 123L, 124L,
> 125L, 126L, 127L, 128L, 129L, 130L, 131L, 131L, 132L, 132L, 133L,
> 133L, 134L, 135L, 135L, 136L, 136L, 137L, 138L, 138L, 139L, 140L,
> 141L, 142L, 143L, 144L, 145L, 146L, 146L, 147L, 148L, 149L, 150L,
> 151L, 152L, 153L, 154L, 155L, 156L, 157L, 157L, 158L, 158L, 159L,
> 159L, 160L, 160L, 161L, 162L, 163L, 164L, 164L, 165L, 165L, 166L,
> 166L, 167L, 167L, 168L, 168L, 169L, 170L, 170L, 171L, 171L, 172L,
> 172L, 173L, 173L, 174L, 174L, 175L, 175L, 176L, 176L, 177L, 178L,
> 178L, 179L, 179L, 180L, 180L, 181L, 182L, 183L, 183L, 184L, 184L,
> 185L, 186L, 187L, 188L, 188L, 189L, 190L, 190L, 191L, 191L, 192L,
> 193L, 194L, 195L, 195L, 196L, 196L, 197L, 197L, 198L, 198L, 199L,
> 199L, 200L, 201L, 201L, 202L, 203L, 203L, 204L, 205L, 206L, 207L,
> 208L, 209L, 210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L,
> 219L, 220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
> 230L, 230L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 9L, 10L, 11L,
> 12L, 12L, 13L, 13L, 14L, 14L, 15L, 16L, 16L, 17L, 17L, 18L, 19L,
> 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 27L, 28L, 28L, 29L, 30L,
> 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 38L, 39L, 40L, 40L, 41L,
> 41L, 42L, 43L, 44L, 45L, 46L, 47L, 47L, 48L, 49L, 50L, 51L, 52L,
> 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 59L, 60L, 61L, 62L, 63L,
> 63L, 64L, 65L, 66L, 67L, 68L, 68L, 69L, 70L, 71L, 72L, 72L, 73L,
> 73L, 74L, 74L, 75L, 76L, 76L, 77L, 78L, 78L, 79L, 80L, 81L, 82L,
> 83L, 84L, 85L, 85L, 86L, 87L, 87L, 88L, 89L, 90L, 91L, 92L, 92L,
> 93L, 94L, 94L, 95L, 96L, 96L, 97L, 98L, 98L, 99L, 100L, 100L,
> 101L, 101L, 102L, 102L, 103L, 104L, 104L, 105L, 106L, 106L, 107L,
> 107L, 108L, 109L, 110L, 110L, 111L, 111L, 112L, 113L, 114L, 114L,
> 115L, 116L, 117L), .Label = c("2016-06-01", "2016-06-06", "2016-06-12",
> "2016-06-14", "2016-06-16", "2016-06-17", "2016-06-18", "2016-06-19",
> "2016-06-21", "2016-06-22", "2016-06-23", "2016-06-24", "2016-06-26",
> "2016-06-27", "2016-06-28", "2016-06-30", "2016-07-01", "2016-07-03",
> "2016-07-05", "2016-07-07", "2016-07-08", "2016-07-09", "2016-07-11",
> "2016-07-12", "2016-07-14", "2016-07-16", "2016-07-17", "2016-07-18",
> "2016-07-19", "2016-07-20", "2016-07-21", "2016-07-22", "2016-07-23",
> "2016-07-25", "2016-07-26", "2016-07-27", "2016-07-28", "2016-07-29",
> "2016-07-30", "2016-08-01", "2016-08-02", "2016-08-03", "2016-08-04",
> "2016-08-05", "2016-08-06", "2016-08-07", "2016-08-08", "2016-08-09",
> "2016-08-10", "2016-08-11", "2016-08-12", "2016-08-13", "2016-08-14",
> "2016-08-15", "2016-08-16", "2016-08-18", "2016-08-19", "2016-08-20",
> "2016-08-21", "2016-08-25", "2016-08-26", "2016-08-28", "2016-09-02",
> "2016-09-04", "2016-09-05", "2016-09-06", "2016-09-07", "2016-09-08",
> "2016-09-09", "2016-09-10", "2016-09-11", "2016-09-12", "2016-09-13",
> "2016-09-14", "2016-09-17", "2016-09-18", "2016-09-19", "2016-09-20",
> "2016-09-23", "2016-09-24", "2016-09-26", "2016-09-27", "2016-09-28",
> "2016-09-29", "2016-09-30", "2016-10-02", "2016-10-03", "2016-10-04",
> "2016-10-05", "2016-10-06", "2016-10-08", "2016-10-09", "2016-10-11",
> "2016-10-12", "2016-10-13", "2016-10-14", "2016-10-15", "2016-10-16",
> "2016-10-18", "2016-10-19", "2016-10-20", "2016-10-21", "2016-10-22",
> "2016-10-23", "2016-10-24", "2016-10-25", "2016-10-27", "2016-10-28",
> "2016-10-29", "2016-10-30", "2016-10-31", "2016-11-01", "2016-11-02",
> "2016-11-07", "2016-11-17", "2016-11-25", "2016-11-27", "2017-06-19",
> "2017-07-06", "2017-07-08", "2017-07-12", "2017-07-17", "2017-07-18",
> "2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24",
> "2017-07-25", "2017-07-26", "2017-07-27", "2017-07-29", "2017-07-31",
> "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05",
> "2017-08-07", "2017-08-09", "2017-08-10", "2017-08-13", "2017-08-15",
> "2017-08-16", "2017-08-17", "2017-08-18", "2017-08-20", "2017-08-24",
> "2017-08-25", "2017-08-26", "2017-08-28", "2017-08-29", "2017-09-03",
> "2017-09-04", "2017-09-06", "2017-09-08", "2017-09-10", "2017-09-11",
> "2017-09-12", "2017-09-14", "2017-09-15", "2017-09-16", "2017-09-17",
> "2017-09-18", "2017-09-19", "2017-09-21", "2017-09-22", "2017-09-23",
> "2017-09-24", "2017-09-25", "2017-09-26", "2017-09-27", "2017-09-28",
> "2017-09-29", "2017-09-30", "2017-10-01", "2017-10-02", "2017-10-03",
> "2017-10-04", "2017-10-06", "2017-10-07", "2017-10-08", "2017-10-10",
> "2017-10-11", "2017-10-12", "2017-10-14", "2017-10-15", "2017-10-16",
> "2017-10-19", "2017-10-20", "2017-10-22", "2017-10-23", "2017-10-24",
> "2017-10-25", "2017-10-26", "2017-10-27", "2017-10-28", "2017-10-29",
> "2017-10-30", "2017-10-31", "2017-11-01", "2017-11-02", "2017-11-03",
> "2017-11-04", "2017-11-05", "2017-11-06", "2017-11-07", "2017-11-09",
> "2017-11-10", "2017-11-11", "2017-11-13", "2017-11-16", "2017-11-17",
> "2017-11-21", "2017-11-22", "2017-11-23", "2017-11-27", "2017-11-28",
> "2017-11-29", "2017-11-30", "2017-12-02", "2017-12-03", "2017-12-05",
> "2017-12-09", "2017-12-10", "2017-12-11", "2017-12-13", "2017-12-14",
> "2017-12-20", "2017-12-21", "2018-07-03", "2018-07-06", "2018-07-07",
> "2018-07-08", "2018-07-09", "2018-07-10", "2018-07-11", "2018-07-12",
> "2018-07-13", "2018-07-14", "2018-07-16", "2018-07-18", "2018-07-19",
> "2018-07-20", "2018-07-21", "2018-07-22", "2018-07-24", "2018-07-25",
> "2018-07-26", "2018-07-27", "2018-07-28", "2018-07-29", "2018-07-30",
> "2018-07-31", "2018-08-01", "2018-08-02", "2018-08-03", "2018-08-04",
> "2018-08-05", "2018-08-07", "2018-08-08", "2018-08-09", "2018-08-10",
> "2018-08-11", "2018-08-12", "2018-08-13", "2018-08-14", "2018-08-15",
> "2018-08-16", "2018-08-17", "2018-08-18", "2018-08-20", "2018-08-24",
> "2018-08-26", "2018-08-27", "2018-08-28", "2018-08-29", "2018-08-30",
> "2018-08-31", "2018-09-02", "2018-09-03", "2018-09-04", "2018-09-05",
> "2018-09-06", "2018-09-07", "2018-09-08", "2018-09-09", "2018-09-10",
> "2018-09-11", "2018-09-12", "2018-09-13", "2018-09-14", "2018-09-15",
> "2018-09-17", "2018-09-18", "2018-09-19", "2018-09-20", "2018-09-21",
> "2018-09-22", "2018-09-23", "2018-09-24", "2018-09-26", "2018-09-27",
> "2018-09-28", "2018-09-29", "2018-09-30", "2018-10-01", "2018-10-02",
> "2018-10-03", "2018-10-05", "2018-10-06", "2018-10-08", "2018-10-09",
> "2018-10-10", "2018-10-12", "2018-10-13", "2018-10-14", "2018-10-17",
> "2018-10-18", "2018-10-19", "2018-10-22", "2018-10-27", "2018-10-28",
> "2018-10-29", "2018-11-01", "2018-11-03", "2018-11-04", "2018-11-05"
> ), class = "factor"), abundance = c(0, 2, 5, 6, 6, 7, 7, 7, 7,
> 9, 11, 13, 13, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 22,
> 23, 24, 25, 29, 31, 32, 34, 36, 36, 37, 37, 38, 39, 40, 40, 40,
> 40, 40, 41, 41, 41, 44, 44, 44, 47, 47, 47, 47, 47, 47, 47, 47,
> 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
> 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
> 48, 48, 48, 48, 48, 48, 48, 48, 48, 1, 2, 2, 2, 3, 4, 5, 6, 6,
> 6, 7, 9, 10, 11, 12, 14, 14, 15, 15, 16, 18, 19, 21, 22, 24,
> 25, 25, 26, 27, 28, 29, 30, 31, 31, 33, 33, 35, 36, 37, 38, 39,
> 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
> 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
> 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
> 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0,
> 1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 10, 10, 10, 10,
> 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 16, 18, 19,
> 20, 21, 21, 21, 21, 21, 24, 25, 26, 28, 29, 31, 32, 33, 34, 35,
> 35, 35, 36, 36, 37, 39, 41, 42, 42, 43, 43, 43, 44, 44, 45, 47,
> 47, 47, 47, 48, 49, 49, 50, 50, 50, 50, 50, 50, 51, 52, 52, 52,
> 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
> 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
> 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
> 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
> 55, 55, 55, 55, 55), DATE = c("07/03", "07/06", "07/07", "07/08",
> "07/09", "07/10", "07/11", "07/12", "07/13", "07/14", "07/16",
> "07/18", "07/19", "07/20", "07/21", "07/22", "07/24", "07/25",
> "07/26", "07/27", "07/28", "07/29", "07/30", "07/31", "08/01",
> "08/02", "08/03", "08/04", "08/05", "08/07", "08/08", "08/09",
> "08/10", "08/11", "08/12", "08/13", "08/14", "08/15", "08/16",
> "08/17", "08/18", "08/20", "08/24", "08/26", "08/27", "08/28",
> "08/29", "08/30", "08/31", "09/02", "09/03", "09/04", "09/05",
> "09/06", "09/07", "09/08", "09/09", "09/10", "09/11", "09/12",
> "09/13", "09/14", "09/15", "09/17", "09/18", "09/19", "09/20",
> "09/21", "09/22", "09/23", "09/24", "09/26", "09/27", "09/28",
> "09/29", "09/30", "10/01", "10/02", "10/03", "10/05", "10/06",
> "10/08", "10/09", "10/10", "10/12", "10/13", "10/14", "10/17",
> "10/18", "10/19", "10/22", "10/27", "10/28", "10/29", "11/01",
> "11/03", "11/04", "11/05", "06/19", "07/06", "07/08", "07/12",
> "07/17", "07/18", "07/20", "07/21", "07/22", "07/23", "07/24",
> "07/25", "07/26", "07/27", "07/27", "07/29", "07/29", "07/31",
> "07/31", "08/01", "08/02", "08/02", "08/03", "08/03", "08/04",
> "08/05", "08/05", "08/07", "08/09", "08/10", "08/13", "08/15",
> "08/16", "08/17", "08/18", "08/18", "08/20", "08/24", "08/25",
> "08/26", "08/28", "08/29", "09/03", "09/04", "09/06", "09/08",
> "09/10", "09/10", "09/11", "09/11", "09/12", "09/12", "09/14",
> "09/14", "09/15", "09/16", "09/17", "09/18", "09/18", "09/19",
> "09/19", "09/21", "09/21", "09/22", "09/22", "09/23", "09/23",
> "09/24", "09/25", "09/25", "09/26", "09/26", "09/27", "09/27",
> "09/28", "09/28", "09/29", "09/29", "09/30", "09/30", "10/01",
> "10/01", "10/02", "10/03", "10/03", "10/04", "10/04", "10/06",
> "10/06", "10/07", "10/08", "10/10", "10/10", "10/11", "10/11",
> "10/12", "10/14", "10/15", "10/16", "10/16", "10/19", "10/20",
> "10/20", "10/22", "10/22", "10/23", "10/24", "10/25", "10/26",
> "10/26", "10/27", "10/27", "10/28", "10/28", "10/29", "10/29",
> "10/30", "10/30", "10/31", "11/01", "11/01", "11/02", "11/03",
> "11/03", "11/04", "11/05", "11/06", "11/07", "11/09", "11/10",
> "11/11", "11/13", "11/16", "11/17", "11/21", "11/22", "11/23",
> "11/27", "11/28", "11/29", "11/30", "12/02", "12/03", "12/05",
> "12/09", "12/10", "12/11", "12/13", "12/14", "12/20", "12/21",
> "12/21", "06/01", "06/06", "06/12", "06/14", "06/16", "06/17",
> "06/18", "06/19", "06/21", "06/21", "06/22", "06/23", "06/24",
> "06/24", "06/26", "06/26", "06/27", "06/27", "06/28", "06/30",
> "06/30", "07/01", "07/01", "07/03", "07/05", "07/07", "07/08",
> "07/09", "07/11", "07/12", "07/14", "07/16", "07/17", "07/17",
> "07/18", "07/18", "07/19", "07/20", "07/21", "07/22", "07/23",
> "07/25", "07/26", "07/27", "07/28", "07/29", "07/29", "07/30",
> "08/01", "08/01", "08/02", "08/02", "08/03", "08/04", "08/05",
> "08/06", "08/07", "08/08", "08/08", "08/09", "08/10", "08/11",
> "08/12", "08/13", "08/13", "08/14", "08/15", "08/16", "08/18",
> "08/19", "08/20", "08/21", "08/21", "08/25", "08/26", "08/28",
> "09/02", "09/02", "09/04", "09/05", "09/06", "09/07", "09/08",
> "09/08", "09/09", "09/10", "09/11", "09/12", "09/12", "09/13",
> "09/13", "09/14", "09/14", "09/17", "09/18", "09/18", "09/19",
> "09/20", "09/20", "09/23", "09/24", "09/26", "09/27", "09/28",
> "09/29", "09/30", "09/30", "10/02", "10/03", "10/03", "10/04",
> "10/05", "10/06", "10/08", "10/09", "10/09", "10/11", "10/12",
> "10/12", "10/13", "10/14", "10/14", "10/15", "10/16", "10/16",
> "10/18", "10/19", "10/19", "10/20", "10/20", "10/21", "10/21",
> "10/22", "10/23", "10/23", "10/24", "10/25", "10/25", "10/27",
> "10/27", "10/28", "10/29", "10/30", "10/30", "10/31", "10/31",
> "11/01", "11/02", "11/07", "11/07", "11/17", "11/25", "11/27"
> ), site = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> "A", "A", "A")), .Names = c("year", "date", "abundance", "DATE",
> "site"), row.names = c(NA, 403L), class = "data.frame")
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: creating a line plot for time series data for several years

Marna Wagley
Thank you, Rui. It helped me a lot. It is highly appreciated.
thanks,

On Thu, Sep 5, 2019 at 1:14 AM Rui Barradas <[hidden email]> wrote:

> Hello,
>
> Thanks for the reproducible example.
> All you have to do is to use the aesthetic group = year in either
> ggplot() or geom_line().
>
> This works:
>
>
> library(ggplot2)
>
> daT$date <- as.Date(daT$date)
> daT$DATE <- format(daT$date, format="%m/%d")
>
> Ab <- ggplot(daT, aes(x = as.factor(DATE),
>                        y = abundance, colour = site)) +
>    geom_line(aes(group = year)) +
>    theme_bw()
>
> Ab + facet_grid(year ~ .) +
>    theme(axis.text.x = element_text(angle = 90,
>                                     hjust = 1,
>                                     size = 4))
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 21:37 de 04/09/19, Marna Wagley escreveu:
> > Hi R Users,
> > I have been getting a trouble to create a time series plot (line) as I
> was
> > trying to create a line graph for each year using month and date (in x
> > axis). I would like to put only one x axis (month and date) for three
> years
> > using the facet_grid, but it has not been creating a lineplot for me. I
> > wanted to compare (visually) whether  the date of observing of the
> > population vary by year.
> > I used the following code but did not plot for me any line. Is there any
> > possibility to create the lines for each year? A sample of the data is
> > given for your information.
> >
> > daT$DATE<-format(as.Date(daT$date), format="%m/%d")
> > Ab<-ggplot(daT, aes(x= as.factor(DATE), y=abundance, colour=site)) +
> >      geom_line() +
> >      theme_bw()
> > Ab+facet_grid(year~.)+theme(axis.text.x = element_text(angle = 90, hjust
> =
> > 1, size=4))
> > ###
> >
> > daT<-structure(list(year = c(2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
> > 2018L, 2018L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
> > 2017L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L,
> > 2016L), date = structure(c(231L, 232L, 233L, 234L, 235L, 236L,
> > 237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L,
> > 248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L,
> > 259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L, 269L,
> > 270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L, 280L,
> > 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L, 290L, 291L,
> > 292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L, 300L, 301L, 302L,
> > 303L, 304L, 305L, 306L, 307L, 308L, 309L, 310L, 311L, 312L, 313L,
> > 314L, 315L, 316L, 317L, 318L, 319L, 320L, 321L, 322L, 323L, 324L,
> > 325L, 326L, 327L, 328L, 118L, 119L, 120L, 121L, 122L, 123L, 124L,
> > 125L, 126L, 127L, 128L, 129L, 130L, 131L, 131L, 132L, 132L, 133L,
> > 133L, 134L, 135L, 135L, 136L, 136L, 137L, 138L, 138L, 139L, 140L,
> > 141L, 142L, 143L, 144L, 145L, 146L, 146L, 147L, 148L, 149L, 150L,
> > 151L, 152L, 153L, 154L, 155L, 156L, 157L, 157L, 158L, 158L, 159L,
> > 159L, 160L, 160L, 161L, 162L, 163L, 164L, 164L, 165L, 165L, 166L,
> > 166L, 167L, 167L, 168L, 168L, 169L, 170L, 170L, 171L, 171L, 172L,
> > 172L, 173L, 173L, 174L, 174L, 175L, 175L, 176L, 176L, 177L, 178L,
> > 178L, 179L, 179L, 180L, 180L, 181L, 182L, 183L, 183L, 184L, 184L,
> > 185L, 186L, 187L, 188L, 188L, 189L, 190L, 190L, 191L, 191L, 192L,
> > 193L, 194L, 195L, 195L, 196L, 196L, 197L, 197L, 198L, 198L, 199L,
> > 199L, 200L, 201L, 201L, 202L, 203L, 203L, 204L, 205L, 206L, 207L,
> > 208L, 209L, 210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L,
> > 219L, 220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
> > 230L, 230L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 9L, 10L, 11L,
> > 12L, 12L, 13L, 13L, 14L, 14L, 15L, 16L, 16L, 17L, 17L, 18L, 19L,
> > 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 27L, 28L, 28L, 29L, 30L,
> > 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 38L, 39L, 40L, 40L, 41L,
> > 41L, 42L, 43L, 44L, 45L, 46L, 47L, 47L, 48L, 49L, 50L, 51L, 52L,
> > 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 59L, 60L, 61L, 62L, 63L,
> > 63L, 64L, 65L, 66L, 67L, 68L, 68L, 69L, 70L, 71L, 72L, 72L, 73L,
> > 73L, 74L, 74L, 75L, 76L, 76L, 77L, 78L, 78L, 79L, 80L, 81L, 82L,
> > 83L, 84L, 85L, 85L, 86L, 87L, 87L, 88L, 89L, 90L, 91L, 92L, 92L,
> > 93L, 94L, 94L, 95L, 96L, 96L, 97L, 98L, 98L, 99L, 100L, 100L,
> > 101L, 101L, 102L, 102L, 103L, 104L, 104L, 105L, 106L, 106L, 107L,
> > 107L, 108L, 109L, 110L, 110L, 111L, 111L, 112L, 113L, 114L, 114L,
> > 115L, 116L, 117L), .Label = c("2016-06-01", "2016-06-06", "2016-06-12",
> > "2016-06-14", "2016-06-16", "2016-06-17", "2016-06-18", "2016-06-19",
> > "2016-06-21", "2016-06-22", "2016-06-23", "2016-06-24", "2016-06-26",
> > "2016-06-27", "2016-06-28", "2016-06-30", "2016-07-01", "2016-07-03",
> > "2016-07-05", "2016-07-07", "2016-07-08", "2016-07-09", "2016-07-11",
> > "2016-07-12", "2016-07-14", "2016-07-16", "2016-07-17", "2016-07-18",
> > "2016-07-19", "2016-07-20", "2016-07-21", "2016-07-22", "2016-07-23",
> > "2016-07-25", "2016-07-26", "2016-07-27", "2016-07-28", "2016-07-29",
> > "2016-07-30", "2016-08-01", "2016-08-02", "2016-08-03", "2016-08-04",
> > "2016-08-05", "2016-08-06", "2016-08-07", "2016-08-08", "2016-08-09",
> > "2016-08-10", "2016-08-11", "2016-08-12", "2016-08-13", "2016-08-14",
> > "2016-08-15", "2016-08-16", "2016-08-18", "2016-08-19", "2016-08-20",
> > "2016-08-21", "2016-08-25", "2016-08-26", "2016-08-28", "2016-09-02",
> > "2016-09-04", "2016-09-05", "2016-09-06", "2016-09-07", "2016-09-08",
> > "2016-09-09", "2016-09-10", "2016-09-11", "2016-09-12", "2016-09-13",
> > "2016-09-14", "2016-09-17", "2016-09-18", "2016-09-19", "2016-09-20",
> > "2016-09-23", "2016-09-24", "2016-09-26", "2016-09-27", "2016-09-28",
> > "2016-09-29", "2016-09-30", "2016-10-02", "2016-10-03", "2016-10-04",
> > "2016-10-05", "2016-10-06", "2016-10-08", "2016-10-09", "2016-10-11",
> > "2016-10-12", "2016-10-13", "2016-10-14", "2016-10-15", "2016-10-16",
> > "2016-10-18", "2016-10-19", "2016-10-20", "2016-10-21", "2016-10-22",
> > "2016-10-23", "2016-10-24", "2016-10-25", "2016-10-27", "2016-10-28",
> > "2016-10-29", "2016-10-30", "2016-10-31", "2016-11-01", "2016-11-02",
> > "2016-11-07", "2016-11-17", "2016-11-25", "2016-11-27", "2017-06-19",
> > "2017-07-06", "2017-07-08", "2017-07-12", "2017-07-17", "2017-07-18",
> > "2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24",
> > "2017-07-25", "2017-07-26", "2017-07-27", "2017-07-29", "2017-07-31",
> > "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05",
> > "2017-08-07", "2017-08-09", "2017-08-10", "2017-08-13", "2017-08-15",
> > "2017-08-16", "2017-08-17", "2017-08-18", "2017-08-20", "2017-08-24",
> > "2017-08-25", "2017-08-26", "2017-08-28", "2017-08-29", "2017-09-03",
> > "2017-09-04", "2017-09-06", "2017-09-08", "2017-09-10", "2017-09-11",
> > "2017-09-12", "2017-09-14", "2017-09-15", "2017-09-16", "2017-09-17",
> > "2017-09-18", "2017-09-19", "2017-09-21", "2017-09-22", "2017-09-23",
> > "2017-09-24", "2017-09-25", "2017-09-26", "2017-09-27", "2017-09-28",
> > "2017-09-29", "2017-09-30", "2017-10-01", "2017-10-02", "2017-10-03",
> > "2017-10-04", "2017-10-06", "2017-10-07", "2017-10-08", "2017-10-10",
> > "2017-10-11", "2017-10-12", "2017-10-14", "2017-10-15", "2017-10-16",
> > "2017-10-19", "2017-10-20", "2017-10-22", "2017-10-23", "2017-10-24",
> > "2017-10-25", "2017-10-26", "2017-10-27", "2017-10-28", "2017-10-29",
> > "2017-10-30", "2017-10-31", "2017-11-01", "2017-11-02", "2017-11-03",
> > "2017-11-04", "2017-11-05", "2017-11-06", "2017-11-07", "2017-11-09",
> > "2017-11-10", "2017-11-11", "2017-11-13", "2017-11-16", "2017-11-17",
> > "2017-11-21", "2017-11-22", "2017-11-23", "2017-11-27", "2017-11-28",
> > "2017-11-29", "2017-11-30", "2017-12-02", "2017-12-03", "2017-12-05",
> > "2017-12-09", "2017-12-10", "2017-12-11", "2017-12-13", "2017-12-14",
> > "2017-12-20", "2017-12-21", "2018-07-03", "2018-07-06", "2018-07-07",
> > "2018-07-08", "2018-07-09", "2018-07-10", "2018-07-11", "2018-07-12",
> > "2018-07-13", "2018-07-14", "2018-07-16", "2018-07-18", "2018-07-19",
> > "2018-07-20", "2018-07-21", "2018-07-22", "2018-07-24", "2018-07-25",
> > "2018-07-26", "2018-07-27", "2018-07-28", "2018-07-29", "2018-07-30",
> > "2018-07-31", "2018-08-01", "2018-08-02", "2018-08-03", "2018-08-04",
> > "2018-08-05", "2018-08-07", "2018-08-08", "2018-08-09", "2018-08-10",
> > "2018-08-11", "2018-08-12", "2018-08-13", "2018-08-14", "2018-08-15",
> > "2018-08-16", "2018-08-17", "2018-08-18", "2018-08-20", "2018-08-24",
> > "2018-08-26", "2018-08-27", "2018-08-28", "2018-08-29", "2018-08-30",
> > "2018-08-31", "2018-09-02", "2018-09-03", "2018-09-04", "2018-09-05",
> > "2018-09-06", "2018-09-07", "2018-09-08", "2018-09-09", "2018-09-10",
> > "2018-09-11", "2018-09-12", "2018-09-13", "2018-09-14", "2018-09-15",
> > "2018-09-17", "2018-09-18", "2018-09-19", "2018-09-20", "2018-09-21",
> > "2018-09-22", "2018-09-23", "2018-09-24", "2018-09-26", "2018-09-27",
> > "2018-09-28", "2018-09-29", "2018-09-30", "2018-10-01", "2018-10-02",
> > "2018-10-03", "2018-10-05", "2018-10-06", "2018-10-08", "2018-10-09",
> > "2018-10-10", "2018-10-12", "2018-10-13", "2018-10-14", "2018-10-17",
> > "2018-10-18", "2018-10-19", "2018-10-22", "2018-10-27", "2018-10-28",
> > "2018-10-29", "2018-11-01", "2018-11-03", "2018-11-04", "2018-11-05"
> > ), class = "factor"), abundance = c(0, 2, 5, 6, 6, 7, 7, 7, 7,
> > 9, 11, 13, 13, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 22,
> > 23, 24, 25, 29, 31, 32, 34, 36, 36, 37, 37, 38, 39, 40, 40, 40,
> > 40, 40, 41, 41, 41, 44, 44, 44, 47, 47, 47, 47, 47, 47, 47, 47,
> > 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
> > 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
> > 48, 48, 48, 48, 48, 48, 48, 48, 48, 1, 2, 2, 2, 3, 4, 5, 6, 6,
> > 6, 7, 9, 10, 11, 12, 14, 14, 15, 15, 16, 18, 19, 21, 22, 24,
> > 25, 25, 26, 27, 28, 29, 30, 31, 31, 33, 33, 35, 36, 37, 38, 39,
> > 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
> > 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
> > 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
> > 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> > 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> > 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
> > 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0,
> > 1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 10, 10, 10, 10,
> > 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 16, 18, 19,
> > 20, 21, 21, 21, 21, 21, 24, 25, 26, 28, 29, 31, 32, 33, 34, 35,
> > 35, 35, 36, 36, 37, 39, 41, 42, 42, 43, 43, 43, 44, 44, 45, 47,
> > 47, 47, 47, 48, 49, 49, 50, 50, 50, 50, 50, 50, 51, 52, 52, 52,
> > 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
> > 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
> > 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
> > 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
> > 55, 55, 55, 55, 55), DATE = c("07/03", "07/06", "07/07", "07/08",
> > "07/09", "07/10", "07/11", "07/12", "07/13", "07/14", "07/16",
> > "07/18", "07/19", "07/20", "07/21", "07/22", "07/24", "07/25",
> > "07/26", "07/27", "07/28", "07/29", "07/30", "07/31", "08/01",
> > "08/02", "08/03", "08/04", "08/05", "08/07", "08/08", "08/09",
> > "08/10", "08/11", "08/12", "08/13", "08/14", "08/15", "08/16",
> > "08/17", "08/18", "08/20", "08/24", "08/26", "08/27", "08/28",
> > "08/29", "08/30", "08/31", "09/02", "09/03", "09/04", "09/05",
> > "09/06", "09/07", "09/08", "09/09", "09/10", "09/11", "09/12",
> > "09/13", "09/14", "09/15", "09/17", "09/18", "09/19", "09/20",
> > "09/21", "09/22", "09/23", "09/24", "09/26", "09/27", "09/28",
> > "09/29", "09/30", "10/01", "10/02", "10/03", "10/05", "10/06",
> > "10/08", "10/09", "10/10", "10/12", "10/13", "10/14", "10/17",
> > "10/18", "10/19", "10/22", "10/27", "10/28", "10/29", "11/01",
> > "11/03", "11/04", "11/05", "06/19", "07/06", "07/08", "07/12",
> > "07/17", "07/18", "07/20", "07/21", "07/22", "07/23", "07/24",
> > "07/25", "07/26", "07/27", "07/27", "07/29", "07/29", "07/31",
> > "07/31", "08/01", "08/02", "08/02", "08/03", "08/03", "08/04",
> > "08/05", "08/05", "08/07", "08/09", "08/10", "08/13", "08/15",
> > "08/16", "08/17", "08/18", "08/18", "08/20", "08/24", "08/25",
> > "08/26", "08/28", "08/29", "09/03", "09/04", "09/06", "09/08",
> > "09/10", "09/10", "09/11", "09/11", "09/12", "09/12", "09/14",
> > "09/14", "09/15", "09/16", "09/17", "09/18", "09/18", "09/19",
> > "09/19", "09/21", "09/21", "09/22", "09/22", "09/23", "09/23",
> > "09/24", "09/25", "09/25", "09/26", "09/26", "09/27", "09/27",
> > "09/28", "09/28", "09/29", "09/29", "09/30", "09/30", "10/01",
> > "10/01", "10/02", "10/03", "10/03", "10/04", "10/04", "10/06",
> > "10/06", "10/07", "10/08", "10/10", "10/10", "10/11", "10/11",
> > "10/12", "10/14", "10/15", "10/16", "10/16", "10/19", "10/20",
> > "10/20", "10/22", "10/22", "10/23", "10/24", "10/25", "10/26",
> > "10/26", "10/27", "10/27", "10/28", "10/28", "10/29", "10/29",
> > "10/30", "10/30", "10/31", "11/01", "11/01", "11/02", "11/03",
> > "11/03", "11/04", "11/05", "11/06", "11/07", "11/09", "11/10",
> > "11/11", "11/13", "11/16", "11/17", "11/21", "11/22", "11/23",
> > "11/27", "11/28", "11/29", "11/30", "12/02", "12/03", "12/05",
> > "12/09", "12/10", "12/11", "12/13", "12/14", "12/20", "12/21",
> > "12/21", "06/01", "06/06", "06/12", "06/14", "06/16", "06/17",
> > "06/18", "06/19", "06/21", "06/21", "06/22", "06/23", "06/24",
> > "06/24", "06/26", "06/26", "06/27", "06/27", "06/28", "06/30",
> > "06/30", "07/01", "07/01", "07/03", "07/05", "07/07", "07/08",
> > "07/09", "07/11", "07/12", "07/14", "07/16", "07/17", "07/17",
> > "07/18", "07/18", "07/19", "07/20", "07/21", "07/22", "07/23",
> > "07/25", "07/26", "07/27", "07/28", "07/29", "07/29", "07/30",
> > "08/01", "08/01", "08/02", "08/02", "08/03", "08/04", "08/05",
> > "08/06", "08/07", "08/08", "08/08", "08/09", "08/10", "08/11",
> > "08/12", "08/13", "08/13", "08/14", "08/15", "08/16", "08/18",
> > "08/19", "08/20", "08/21", "08/21", "08/25", "08/26", "08/28",
> > "09/02", "09/02", "09/04", "09/05", "09/06", "09/07", "09/08",
> > "09/08", "09/09", "09/10", "09/11", "09/12", "09/12", "09/13",
> > "09/13", "09/14", "09/14", "09/17", "09/18", "09/18", "09/19",
> > "09/20", "09/20", "09/23", "09/24", "09/26", "09/27", "09/28",
> > "09/29", "09/30", "09/30", "10/02", "10/03", "10/03", "10/04",
> > "10/05", "10/06", "10/08", "10/09", "10/09", "10/11", "10/12",
> > "10/12", "10/13", "10/14", "10/14", "10/15", "10/16", "10/16",
> > "10/18", "10/19", "10/19", "10/20", "10/20", "10/21", "10/21",
> > "10/22", "10/23", "10/23", "10/24", "10/25", "10/25", "10/27",
> > "10/27", "10/28", "10/29", "10/30", "10/30", "10/31", "10/31",
> > "11/01", "11/02", "11/07", "11/07", "11/17", "11/25", "11/27"
> > ), site = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
> > "A", "A", "A")), .Names = c("year", "date", "abundance", "DATE",
> > "site"), row.names = c(NA, 403L), class = "data.frame")
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.