Created
September 5, 2016 06:47
-
-
Save njtierney/e6d481fbfefcd3f5f03eb04dff1878aa to your computer and use it in GitHub Desktop.
find if a matrix contains only missing values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ras_1 <- matrix(data = rep(NA, 100), | |
nrow = 10, | |
ncol = 10, | |
byrow = TRUE) | |
ras_1 | |
ras_2 <- matrix(data = c(1,rep(NA, 99)), | |
nrow = 10, | |
ncol = 10, | |
byrow = TRUE) | |
ras_2 | |
all(is.na(ras_1)) | |
all(is.na(ras_2)) | |
all_na <- function(x) all(is.na(x)) | |
all_na(ras_1) | |
all_na(ras_2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment