search for: stuff12_3data

Displaying 1 result from an estimated 1 matches for "stuff12_3data".

2014 Jul 28
0
lattice, latticeExtra: Adding moving averages to double y plot
...:2009, Type = factor(rep(c("stuff1", "stuff2", "stuff3"), each = 10*3)), Value = rnorm(90, mean = seq(90), sd = rep(c(6, 7, 3), each = 10))) library(Lattice) library(LatticeExtra) stuff1data <- mydata[(mydata$Type) %in% c("stuff1"), ] stuff12_3data <- mydata[(mydata$Type) %in% c("stuff2", "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...