Hello, I have a population of 2000+ zoo time series (but my environment also contains objects that are not zoo time series). I'm trying to calculate the latest 90 days Z-Score of all zoo time series, using the following code:
LZS<-function(ser) { temp<-window(ser,start=Sys.Date()-90) last((temp-mean(temp))/sd(temp)) } sapply(ls(), LZS ) The LZS function works on individual zoo time series, but not when I try to use sapply to do it on the whole objects list. I guess this has to do with the fact that not all objects are zoo. How can I do this correctly? Many thanks, TDB -- View this message in context: http://r.789695.n4.nabble.com/Calculate-the-latest-Z-score-of-all-zoo-time-series-tp3695820p3695820.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.