I am trying to resolve an issue I am having with my data in the hope of prooducing a line plot in ggplot2. This is my data (outputted with dput()). It is suppose to be ten rows and two columns, one of date (d,m,y,h,m) and the other one of counts. Apologies for the state of the code, when I try to reproduce the code more simply, it works, and I can't see where the problem is when I try to produce the graph.
day2 <- structure(list(date = structure(c(1355210880, 1355211000, 1355211120, 1355211240, 1355211360, 1355211480, 1355211600, 1355211720, 1355211840, 1355211960), class = c("POSIXct", "POSIXt"), tzone = ""), Counts = c("12", "45", "12", "4", "2", "3", "2", "2", "2", "0")), .Names = c("date", "Counts"), row.names = 4405:4414, class = "data.frame") The graph I am trying to plot is:
library(ggplot2) g = ggplot(day2, aes(x=date, y=Counts)) g + geom_line() But the resulting graph is simply horizontal lines, and the Counts columns goes up in non consecutive numbers. Can anyone help?