Re: [R] moving average TTR

2011-10-13 Thread R. Michael Weylandt
I believe the lag() function can be used to rig this up. Something like sma.365 <- SMA(lag(data, 12), n=120) # Untested, but seems right Michael On Thu, Oct 13, 2011 at 6:31 AM, Laura wrote: > Hello, > > I used the TTR package in R to calculate moving averages. I have a monthly > time series a

[R] moving average TTR

2011-10-13 Thread Laura
Hello, I used the TTR package in R to calculate moving averages. I have a monthly time series and I would like to calculate the moving average over 10 years with an offset of 1 year. It should be something like sma.365 <- SMA(data, n=120) Does anyone know how to include in offset? Thanks a