[R] Time Series Data
Bill Vedder
bved01 at hia.net
Sun Dec 23 20:40:30 CET 2001
Happy Holidays All,
I'm trying to use stl() to extract a seasonal component from a time
series. I believe the root cause of my problem lies in how I imported
the data into R.
In Excel (csv), the data look like:
Jan Feb Mar ....
1949 12.2 9.0 7.9 ....
1950 17.2 16.9 9.9 ....
1951 8.2 7.0 7.7 ....
I import to R using:
a<-read.csv("d:/programs/r/airpass.csv",header=TRUE, sep = ",")
then I try to coerce a to a .ts object using:
> a.ts<- as.ts(a)
but get the following error:
Error in dimnames<-.data.frame(*tmp*, value = list(NULL, names)) :
invalid dimnames given for data frame
I have tried everything (except what works). When I do:
> mode(a)
R returns:
[1] "list"
Other things I've done show me that R is treating the columns as
separate variables.
How do I specify to R that I want the csv data read as a single,
univariate times series sampled once/month over many years?
Any help is much appreciated.
Best,
Bill Vedder
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list