[Solved] Select and delete rows in r [closed]


If subset is truly a subset of df and no additional rows have been omitted or added to df, filter using row names will work.

xy <- data.frame(sub = rep(letters[1:3], 9), val = runif(9))
xy.sub <- xy[xy$sub %in% "b", ]

xy[!rownames(xy) %in% rownames(xy.sub), ]

To match multiple columns, you can do

xy[!(xy$val %in% xy.sub$val & xy$sub %in% xy.sub$sub), ] #notice the braces

1

solved Select and delete rows in r [closed]