[R] Results of applying na.omit on zoo object
Rich Shepard
rshepard at appl-ecosys.com
Mon Sep 19 21:00:41 CEST 2011
On Mon, 19 Sep 2011, Achim Zeileis wrote:
> This should do what you want, I think:
>
> R> z <- zoo(matrix(1:8, ncol = 2), Sys.Date() + 0:3)
> R> z[2,2] <- NA
> R> z[3,] <- NA
> R> z
>
> 2011-09-19 1 5
> 2011-09-20 2 NA
> 2011-09-21 NA NA
> 2011-09-22 4 8
>
> R> z[!apply(is.na(z), 1, all),]
>
> 2011-09-19 1 5
> 2011-09-20 2 NA
> 2011-09-22 4 8
Z,
I'm quite new to R so I have a lot to learn even reading all I can, so I
ask your patience.
Do I mis-read the above that it applies to a matrix but not a data.frame?
Rich
More information about the R-help
mailing list