我有矩阵:
traits <- matrix(c(1,0,1, 1,0,0, 0,0,0), nrow = 3, ncol=3, byrow=TRUE,
dimnames = list(c("sp1", "sp2", "sp3"),c("Tr1", "Tr2", "Tr3")))
和一份清单
species <-c("sp1", "sp2")
如何过滤“特征”矩阵,使其仅返回匹配项,即
traits.filtered<-matrix(c(1,0, 1,1, 0,0), nrow = 2, ncol=3, byrow=TRUE,
dimnames = list(c("sp1", "sp2"),c("Tr1", "Tr2", "Tr3")))
谢谢你,-伊丽莎白