search for: bwithoutan

Displaying 1 result from an estimated 1 matches for "bwithoutan".

Did you mean: awithoutan
2006 Mar 01
3
matrix matching NA
...ta (a[i] b[i]) with some NA elements: ## R Code a <- (1:5) a[2] <- NA b <- (6:10) b[3] <- NA a 1 NA 3 4 5 b 6 7 NA 9 10 ## /R Code To get two vectors without any NA elements I do the following: ## R Code awithoutan <- a[(1:length(a))[(!is.na(a))&(!is.na(b))]] bwithoutan <- b[(1:length(b))[(!is.na(a))&(!is.na(b))]] awithoutan 1 4 5 bwithoutan 6 9 10 ## /R Code How can I do the same matching in a matrix and get a matrix without NA elements (and less colums of course)? matrix <- array(1:5*2, dim=c(5,2)) matrix[,1] <- a matrix[,2] <- b mat...