我正在寻找一种优雅的,类似于R的方法来捕获数据框中没有将其索引列在向量中的行:
table.combos <- matrix(data = 1:12, nrow = 10, ncol = 6, byrow=T)
table.combos
not.these<-c(2,4,5,9)
x<-table.combos[c(not.these),]
#y<- everything not in x
答案 0 :(得分:2)
只需使用与以下相同的索引向量:
y <- table.combos[-not.these,]
告诉您选择table.combos
中的所有行,但选择not.these
向量中的所有行。