[R] zoo. window

Achim Zeileis Achim.Zeileis at uibk.ac.at
Thu Aug 19 16:46:02 CEST 2010


On Thu, 19 Aug 2010, wyd923 at msn.com wrote:

> Hi, I have a dataset including monthly date from 1971-01-01 to 
> 2009-01-01. The dates are character variables.

I would suggest to use a more suitable class for the index, such as 
"yearmon" (if you only want to indicate the month anyway) or "Date" (if 
you want to use a particular day within the month). From your description, 
I would recommend "yearmon".

Also look at the examples on the manual pages and in the vignettes of the 
package that provide various illustrations of both approaches.

> I want to select the subsample from my original data, so I use
> mydata3<-window(mydata,start="1972-02-01",end="2005-02-01"),
> or mydata3<-window(mydata, start=as.date("1972-02-01"),end=as.date("2005-02-01"))
> or mydata3<-window(mydata, start=c(1972-02-01),end=c(2005-02-01))
>
> but I constantly receive
> Error in attr(x, "tsp") <- c(1, NROW(x), 1) :
>  invalid time series parameters specified
>
> I don't know how to fix it in this case.
>
> Many thanks
> YD
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list