I have the following data frame called test:
> test
concat grpRnk
1 1.1 1
2 1.2 1
3 2.1 3
4 2.1 2
5 2.2 3
6 2.2 2
7 3.1 4
8 3.2 4
And I run this bit of dplyr code test %>% distinct(concat, .keep_all = TRUE) to get the following output, showing the unique rows in the concat column:
> test %>% distinct(concat, .keep_all = TRUE)
concat grpRnk
1 1.1 1
2 1.2 1
3 2.1 3
4 2.2 3
5 3.1 4
6 3.2 4
How do I modify this bit of code to instead remove rows numbers 3 and 5 in the original test data frame where grpRnk was 3 for both? The current bit of code removed those dupes where grpRnk = 2. In base R is fine too!
Here's the code for generating test data frame:
test <- data.frame(concat = c(1.1,1.2,2.1,2.1,2.2,2.2,3.1,3.2),
grpRnk = c(1,1,3,2,3,2,4,4))