Background
I have a dataframe d
with ~10,000 rows and n columns, one of which is an ID
variable. Most ID
's appear once, but some appear more than once. Say that it looks like this:
Problem
I'd like a new dataframe d_sub
which only contains ID
's that appear more than once in d
. I'd like to have something that looks like this:
What I've tried
I've tried something like this:
d_sub <- subset(d, duplicated(d$ID))
But that only gets me one entry for ID
's b
and d
, and I want each of their respective rows:
Any thoughts?