Counting duplicated rows

Hey guys, I am having a bit of trouble here.

I want to count the duplicated rows on my df.

Example df

a = c(1, 1, 1, 2, 2, 2, 3, 4, 4)
b = c(3.5, 3.5, 2.5, 2.5,3, 2.5, 1, 2.2, 7)
df <-data.frame(a,b)

#This was my 1st step, trying to understand the duplicate values, and then I would count them but...

df %>% duplicate() #Nothing is happening and I keep the exact same values from df. it is like duplicate is doing nothing

So I want to know how many duplicates I have in my df.
Bonus questions: how to subset my duplicate values to another data frame?

Not sure if it is important but:
In my original Data Frame I have more columns

This will give duplicated rows:


And this will give number of duplicates:


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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.