2012-05-09 Rで移動平均 R Rで移動平均 moving_average<-function(ts123,lag){ tmp<-0 for(i in 1:lag){ tmp<-tmp+ts123[(i):(length(ts123)-(lag-i))]/lag } tmp<-c(rep(NA,lag-1),tmp) tmp } j<-moving_average(ll,32) plot(j)