Created
August 6, 2015 14:15
-
-
Save jonesor/edefb525c027d970085b to your computer and use it in GitHub Desktop.
How to subset COMADRE Animal Matrix Database
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 COMADRE Animal Matrix Database (works with COMPADRE too) | |
#Create a vector of indices to retain | |
subsetID <- which(comadre$metadata$Order %in% c("Monotremata","Didelphimorphia","Paucituberculata","Microbiotheria","Dasyurormorphia","Peramelemorphia","Diprotodontia")) | |
#Subset entire COMADRE object to JUST the above subset | |
#First make a copy | |
subset.comadre <- comadre | |
#Now subset the sub-parts of the database | |
#metadata | |
subset.comadre$metadata <- mammal.comadre$metadata[subsetID,] | |
#matrices | |
subset.comadre$mat <- mammal.comadre$mat[subsetID] | |
#matrix class information | |
subset.comadre$matmatrixClass <- mammal.comadre$matrixClass[subsetID] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is now superceded by the
subsetDB
function in theRcompadre
package