I have a dataset:
TimeSeries <- data.frame(date=c("2013","2013","2013","2014","2014","2015","2015","2016", "2016","2017","2017"),
score=c(-0.333, 0.500, 0.000, 0.333, -0.500, 0.777, -0.450, 0.667, -0.011, 0.111, -0.145))
Now I just want to simply plot this as a time series, that shows all observations, every year. I just the code:
ggplot(TimeSeries, aes(x = date, y = score)) +
geom_line() + scale_x_discrete(breaks = c(2013,2014,2015,2016))
This gives me the following:
But instead of this, I want the observations from "2013" to be in order as they come in the dataset, in between "2013" and "2014" on the xas. Thus this will be a line going from: -0.333 to 0.500 to 0.000. Same for all other years and observations. They need to be attached to each other, in the order that they come in the dataset. So first of 2013 first, then second, etc. Can anyone help?


