not sure if this is the best way, but you can use zoo and xts:
dates <- as.Date(Sys.time()) + runif(1000,-180,0);
values <- rnorm(1000);
library(zoo)
library(xts)
# convert data into zoo object, and extract min, mean, max of each week
# see ?apply.weekly
r <- llply(c(min = min, mean = mean, max = max), function(f)
apply.weekly(zoo(values, dates), f))
# convert xts data into data.frame so that ggplot2 can handle them.
df <- as.data.frame(do.call("cbind", r))
df$weeks <- time(r[[1]])
# your plot
myplot <- ggplot(aes(x=weeks, y=mean, ymin=min, ymax=max), data=df) +
geom_ribbon(alpha=0.3) +
geom_line(size=1, color="blue") +
geom_point(size=3, color="red")
myplot
kohske
--
Kohske Takahashi <takahash...@gmail.com>
Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/