BK<- [1 2 3;
4 NA 6;
7 8 NA;
10 11 NA]
How to remove rows containing NAs from column 2 without removing rows containing NAs from column 3 in R?
Many thanks!
BK<- [1 2 3;
4 NA 6;
7 8 NA;
10 11 NA]
How to remove rows containing NAs from column 2 without removing rows containing NAs from column 3 in R?
Many thanks!
Try this
BK[is.na(BK[,1:2])] <- 0
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 0 8
[3,] 3 6 NA
BK <- matrix(c(1,2,3,4,NA,6,7,8,NA),3,3)