I have a data set which looks like as follows:
A B C
liver 5 RX
blood 9 DK
liver 7 DK
intestine 5 RX
blood 3 DX
blood 1 DX
skin 2 RX
skin 2 DX
I want to keep only the duplicated (not triplicates or so on) entries based on A
. Meaning if values in A
are duplicate it should print the entire row.
The ideal output will look like:
A B C
liver 5 RX
liver 7 DK
skin 2 RX
skin 2 DX
I tried using the following code with dplyr
df %>% group_by(A) %>% filter(n() >= 1)
Could someone please help me here?