[R] Moving Averages in ggplot2
fruminator
michael at frumin.net
Thu Dec 10 20:15:47 CET 2009
Hello all,
Have some time series data stored in a data.frame, and am plotting it with
ggplot2 (which is totally awesome). I have explored the documentation and
mailing list archives, and I can't see any way to plot a 'smoother' that is
just the K-step moving average.
For example, imagine I had a data.frame called 'sleep' with 'date' as the
date (from as.Date()) and 'hours' as the # hours I slept that night, I would
love to do something like:
qplot(date, hours, data = sleep) + stat_smooth(method = 'movingaverage', k =
7);
does such a thing exist? If not, I know the package is extensible, so any
guidance as to how make it to do so would be very much appreciated.
Thanks,
Mike
--
View this message in context: http://n4.nabble.com/Moving-Averages-in-ggplot2-tp958867p958867.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list