[R] ts and stl functions

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 12 16:41:15 CEST 2006


On Wed, 12 Jul 2006, Daniel sutcliffe wrote:

> Hi, 
> 
> I have imported a csv file into R which contains one column (the rate er 100,000 population of a disease, by month over 11 years) I coerced into a time series using the following function, 
> 
> tstkr<-ts(tkr,deltat=1/12) 

That's likely making a ts out of a data frame and not the one column of 
the data frame.  What does dim(tkr) say?

> 
> This seems to work fine, and when I check for the class of the object using class(tstkr) I get "ts" as the response. 
> 
> When I try to use the stl function in stats I get the error message: 
> 
> Error in stl(tstkr)only univariate series are allowed 
> 
> I then tried this: 
> 
> tstkr <- ts(c(tkr), deltat=1/12) 
> 
> however this made no difference...I still get an error - does anybody know what is wrong? 

Try tkr[[1]]

> 
> Regards, 
> 
> Daniel 
> 
>  		
> ---------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list