Displaying 1 result from an estimated 1 matches for "tf4192605".
2007 Jul 31
2
remove NA rows and columns
Hello,
I guess, it's a rather simple thing but I cannot find a short way to reduce a
matrix, removing all rows and columns having just NA elements.
testmatrix <- matrix(nrow=6, ncol=4)
testmatrix[2:5,2:3] <- seq(2)
> testmatrix
[,1] [,2] [,3] [,4]
[1,] NA NA NA NA
[2,] NA 1 1 NA
[3,] NA 2 2 NA
[4,] NA 1 1 NA
[5,] NA 2 2 NA