[R-SIG-Finance] xts question: Extract rows with an NA
Worik
worik.stanton at gmail.com
Wed Oct 6 00:04:28 CEST 2010
On 06/10/10 10:56, Worik wrote:
> I wish to extract rows from an xts object that have a NA entry. I can
> use na.omit to exclude those rows, but I can find no simple way to
> include them.
>
> Is there such a way?
>
> > X <- xts(cbind(c(1,2,3), c(1,NA,5)), Sys.Date()+1:3)
OK. I can say:
> X[is.na(X[,1]) | is.na(X[,2])]
[,1] [,2]
2010-10-08 2 NA
This solves my immediate problem. But is there a generic way that would
work for any number of columns?
Worik
--
You do not have to be blind to not see what is going on right in front of you if it is behind your back
Pascall West
--
More information about the R-SIG-Finance
mailing list