R Help Community
I'm trying to understand time series (TS) objects. Thought I understood but
recently have run into a series of error messages that I'm not sure how to
handle. I have 15 years of quarterly data and I typically create a TS object
via something like...
data.ts <- ts(mydata, start = 2002, frequency = 4)
this create a matric as opposed to a vector object as I receive a univariate
error when I try to decompose the data using the STL function
data.stl <- stl(data.ts, "periodic")
Error in stl(data.ts, "periodic") : only univariate series are allowed
so to convert to a vector I'll use
data.ts <- as.vector(data.ts)
but then I lose the frequency as the periods as the data becomes frequency = 1
data.ts <- stl <- stl(data.ts, "periodic")
Error in stl(data.ts, "periodic") :
series is not periodic or has less than two periods.
So am I missing a parameter or is there a more general/proper way to create a
time series object? First time I've run into this problem . I can always
decompose via an alternative methods so there are work arounds. But just
trying to understand what I'm not doing programmatically at this point.
Remail@example.com mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.