I'm trying to create a line plot from the following data:
> dput(agdata)
structure(list(date = c("2014-11-30", "2014-12-01", "2014-12-02",
"2014-12-03", "2014-12-04", "2014-12-05", "2014-12-06", "2014-12-07",
"2014-12-14", "2014-12-15", "2014-12-16", "2014-12-17", "2014-12-18"
), A = c(86.3333333333333, 91.1666666666667, 83.4, 83, 86, 94.75,
78, 87, 87, 92, 98.6, 87, 85.3333333333333), B = c(1015.16666666667,
1014.33333333333, 1017.2, 1021, 1017.5, 1021.5, 1029, 1022, 1009,
1012.4, 1014.8, 1011, 1011), C = c(8.55666666666667, 7.145, 7.51,
4.61, 4.335, 3.2625, 6.585, 8.35, 9.09, 6.48, 2.532, 11.74, 11.7933333333333
), D = c(24, 74.6666666666667, 77, 57.5, 82.5, 56.25, 0, 88,
32, 61, 50, 92, 80.6666666666667)), .Names = c("date", "A", "B",
"C", "D"), row.names = c(NA, -13L), class = "data.frame")
I tried this:
ggplot(data = agdata,aes(x = date, y = A)) + geom_line(stat="identity")
and various other parameters, including removing the stat parameter, moving aes to geom_line, and a few others. I keep getting:
geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?
To check if the data is fine, I tried:
ggplot(data = agdata,aes(x = date, y = A)) + geom_bar(stat="identity")
which works just fine.
Any pointers as to what I'm missing here? I have a feeling it has something to do with a group=
parameter in aes()
by looking at this, and this, but not sure what.