[R] Extending time series

Fernando Saldanha fsaldan1 at gmail.com
Tue Apr 26 17:52:00 CEST 2005


I noticed that when one tries to extend a time series (ts) object by a
single period using window() actually two observations (NAs) are
added. See below for an example. Does anyone know the reason for this
behavior and how to avoid it?

Thanks.

FS

> x<-ts(c(1,2,3))
> x1<- window(x, start(x), end(x) + 1, extend = TRUE)
> x1
Time Series:
Start = 1 
End = 5 
Frequency = 1 
[1]  1  2  3 NA NA




More information about the R-help mailing list