我想在此基础上有重复的ID列的一个子集3列,这样我只得到3列,因为他们独特的价值观子集列复制
structure(list(ID = 1:4, x = c(46L, 47L, 47L, 47L), y = c(5L,
6L,7L,7L )),.Names = c(“ID”,“x”,“y”),row.names = c(1L,6L, 11L,16L),class =“data.frame”)
我想在此基础上有重复的ID列的一个子集3列,这样我只得到3列,因为他们独特的价值观子集列复制
structure(list(ID = 1:4, x = c(46L, 47L, 47L, 47L), y = c(5L,
6L,7L,7L )),.Names = c(“ID”,“x”,“y”),row.names = c(1L,6L, 11L,16L),class =“data.frame”)
using在数据框方法应该重复工作:
dat[!duplicated(dat),] # (equivalent here to dat[!duplicated(dat$ID),])
ID x y
1 1 46 5
6 2 47 6
11 3 47 7
16 4 47 7
我想返回t他是3列,但当他们没有重复。 – jonestats
不是这样,你的公式实际上工作。我想返回三列的数据框,但没有重复。 – jonestats
是的,我得到了答案。 – jonestats