[R] time series has no or less than 2 periods

Rajaraman V rajaraman.v at gmail.com
Mon Jan 6 18:38:20 CET 2014



blockLength <- 37 # can be anything you like
ts1 <- ts(rnorm(2*blockLength-1, 0,2), frequency=blockLength)
de <- decompose(ts1)  # error

ts2 <- ts(rnorm(2*blockLength, 0,2), frequency=blockLength)
de <- decompose(ts2)
plot(de)

So the trick is to have at least two periods in your time series. Even 
reduce one data point, and you will see this error.


More information about the R-help mailing list