Hi R-users,
I have an array similar to this:
tmp <- array(1:6, c(2,3,3))
n1 <- c("one", "two")
n2 <- c("three", "four", "five")
n3 <- c("six", "seven", "eight")
dimnames(tmp) <- list(n1, n2, n3)
tmp[1,,1] <- NA
tmp[1,3,2] <- NA
tmp[2,,3] <- NA
tmp
How to subset !is.na(x) rows resulting
, , six
three four five
two 2 4 6
, , seven
three four five
one 1 3 NA
two 2 4 6
, , eight
three four five
one 1 3 5
I have tried something like
tmp[!apply(is.na(tmp), 1, all),,]
with negative results.
Thanks
-Lauri
______________________________________________
[email protected] 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.