[R] [<- and indexing for zoo objects

Achim Zeileis Achim.Zeileis at R-project.org
Mon Nov 14 17:06:02 CET 2005


Tobias,

thanks for the report:

> > a[I(2003), 2] <- NA
> Error: subscript out of bounds

Yes, we would have to write a [<-.zoo method for that, currently we
rely on the corresponding methods for matrices and vectors. I'll add it
to the WISHLIST and try to add this functionality for the next zoo
release.

All the indexing can also be done via window<-

window(a, start = 2003, end = 2003)[,2] <- NA

which would currently be the preferred solution.

thx,
Z




More information about the R-help mailing list