My question is very similar to this one Subset with unique cases, based on multiple columns. The only difference is I don't want the duplicated value to show up in the final data frame. Original dataframe:
df
v1 v2 v3 v4 v5
1 7 1 A 100 98
2 7 2 A 98 97
3 8 1 C NA 80
4 8 1 C 78 75
5 8 1 C 50 62
6 9 3 C 75 75
using > df[!duplicated(df[1:3]),]
gets me
v1 v2 v3 v4 v5
1 7 1 A 100 98
2 7 2 A 98 97
3 8 1 C NA 80
6 9 3 C 75 75
But what I would like is
v1 v2 v3 v4 v5
1 7 1 A 100 98
2 7 2 A 98 97
6 9 3 C 75 75
I tried using unique but it seems it's just keeping the column I am analyzing. Any help would be greatly appreciated!