Sto cercando un modo elegante e simile a R per catturare le righe in un dataframe che non ha i loro indici elencati in un vettore:
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
risposte:
2 per risposta № 1Usa lo stesso vettore indice come in:
y <- table.combos[-not.these,]
che dice di scegliere tutte le righe da table.combos
ma quelli contenuti in not.these
vettore.