Displaying 1 result from an estimated 1 matches for "madfstuff1".
2014 Jul 28
0
lattice, latticeExtra: Adding moving averages to double y plot
...quot;stuff3"), ]
# make moving averages function using zoo and rollmean:
library(zoo)
library(plyr)
f <- function(d)
{
require(zoo)
data.frame(Year = d$Year[5:length(d$Year)],
mavg = rollmean(d$Value, 5))
}
# Apply the function to each group as well as both data frames:
madfStuff1 <- ddply(stuff1data, "Type", f)
madfStuff2_3 <- ddply(stuff12_3data, "Type", f)
# Some styles:
myStripStyle <- function(which.panel, factor.levels, ...) {
panel.rect(0, 0, 1, 1,
col = bgColors[which.panel],
border = 1)
panel.text(x = 0.5,...