On Mon, 19 Sep 2011, Rich Shepard wrote:

On Mon, 19 Sep 2011, Marc Schwartz wrote:

You can look at ?complete.cases for one approach, presuming that it will
work on zoo objects.

Marc,

 That's the opposite of what I want. It returns only rows with no missing
data. I'm looking for something that will return rows with _only_ missing
data, and drop them in the bit bucket.

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

hth,
Z

Thanks,

Rich

______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to