[R] How to create a data.frame from several time series?
Robert Latest
boblatest at gmail.com
Tue Apr 17 16:11:55 CEST 2012
Hello all,
followup to yesterday's question: Part of my confusion was caused by
my embarrassing mistake of overwriting the "ppk" function with another
object, which of course broke the next iteration of the loop.
Secondly, I got exactly what I wanted like this:
aggregate.zoo <- function(series) {
agg <- aggregate(data=series, value ~ month, ppk, lsl=1300, usl=1500)
return (zoo(x=agg$value, order.by=agg$month))
}
l1 = split(df, df$tool)
l2 = lapply(l1, aggregate.zoo)
l3 = do.call(merge, l2)
I puzzled this together from various example with only 80%
understanding how it works and why.
Regards,
robert
More information about the R-help
mailing list