【发布时间】:2021-01-28 06:50:07
【问题描述】:
将示例数据框视为:
df <- data.frame(a=c(rep(1,4),4,7,8), b=c(rep(4,4),6,8,3),
c=c(rep("hey",4),"hi","hello","salam"),
d=c("q","r","g","y","d","e","y"), e=c(2,6,43,56,6,23,4))
我想删除与列 a、b、c 相同的行。所需的输出将是三行
a b c d e
1 1 4 hey q 2
5 4 6 hi d 6
6 7 8 hello e 23
7 8 3 salam y 4
【问题讨论】:
-
你也可以
df %>% group_by(a, b, c) %>% filter(row_number() == 1)