I have a DF called Base that looks like this:
| Treatment | Gender | ID | 
|---|---|---|
| 1 | M | A | 
| 1 | F | B | 
| 1 | F | B | 
| 1 | F | E | 
| 2 | M | A | 
| 2 | F | B | 
| 2 | M | C | 
| 2 | M | C | 
| 2 | M | D | 
And I would like to count by Treatment and Gender the number of distinct IDs, I have and get it in another dataframe, so I would have a DF called Uniques that would look like this:
| Treatment | Gender | ID | 
|---|---|---|
| 1 | M | 1 | 
| 1 | F | 2 | 
| 2 | M | 3 | 
| 2 | F | 1 | 
I have tried to write this:
Uniques = Base %>% group_by(Treatment, Gender) %>% summarise(count = n_distinct(Base$ID))
But I get the following error:
`summarise()` regrouping output by 'Treatment' (override with `.groups` argument)
What is wrong and how could I fix it?
Thank you
