Selecting columns with equal values for each ID

Hi, I have a dataframe of over 6000 observations for 250 client ID's with one of the columns being "Date". I want to pull the the ID's that have any duplicate dates

For instance, my dataset looks like:

ID Date
100 1/1/2020
100 1/2/2020
100 1/4/2020
100 1/4/2020
101 1/1/2020
101 1/1/2020
101 1/2/2020
101 1/4/2020
102 1/1/2020
102 1/2/2020
.......................
And I'm looking to get:

ID Date
100 1/4/2020
100 1/4/2020
101 1/1/2020
101 1/1/2020

This is getting me stuck for some reason.

Thank you!!

In outline group_by(ID,Date) %>% summarize(some_other_variable) -> some_object

Thats just giving me the same dataframe.

So there's 5 columns in the dataframe (ID, Date, time, purchase, class). And I want to figure out if any IDs have multiple duplicated dates.

Then use %>% count() instead of summarise

Thank you sir! This helped me identify which n>1 .. Much appreciated!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.