Created
November 6, 2018 10:45
-
-
Save jonesor/cd1176e4ce5104f8869531ad99add368 to your computer and use it in GitHub Desktop.
How to subset the COMPADRE/COMADRE matrix database based on the matrices themselves. This example counts NA values in the F matrix and uses that to subset.
This file contains 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
#How to subset the matrix database based on the matrices themselves. | |
#This example counts NA values in the F matrix and uses that to subset. | |
nmat <- nrow(compadre$metadata) | |
for(i in 1:nmat){ | |
compadre$metadata$NAinFmat[i] <- sum(is.na(compadre$mat[[i]]$matF)) | |
} | |
table(compadre$metadata$NAinFmat) | |
x <- Rcompadre::subsetDB(compadre,NAinFmat == 0) | |
table(x$metadata$NAinFmat) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment