df = structure(list(V1 = c(1, 2, 2, 3, 4, 5, 5, 6, 7), V2 = c(3.5, 3, 2.5, 2, 3, 2, 3, 5, 4), V3 = c(6.5, 8, 9, 5, 7, 4, 3, 6, 7)), row.names = c(NA, 9L), class = "data.frame")
trash = c(2,3)
如何在不重写df的情况下删除垃圾桶中具有ID的行?
答案 0 :(得分:1)
即使您这样做,我也认为r中没有就位运算
df = structure(list(V1 = c(1, 2, 2, 3, 4, 5, 5, 6, 7), V2 = c(3.5, 3, 2.5, 2, 3, 2, 3, 5, 4), V3 = c(6.5, 8, 9, 5, 7, 4, 3, 6, 7)), row.names = c(NA, 9L), class = "data.frame")
trash = c(2,3)
df = df[-trash,]
它仍然应该重写df。