I would like to create a time series plot using ggplot2 in which the variable plotted over time. However, for each time period, I would like to plot the cumulative count for that period. For example:
set.seed(123)
frame <- data.frame(id = sort(rep(c(0:5), 5)),year = rep(c(2000:2005), 5), y = sample(0:1,30, replace = TRUE))
table(frame$year, frame$y)
ggplot(frame, aes(x = year, y = y)) + geom_point(shape = 1) # Not right
I would ultimately like it to generate a plot like this:
count<- table(frame$year, frame$y)[,2]
plot(2000:2005, count, type = "l")
I'm new to ggplot and any pointers would be greatly appreciated. Thanks.

