I have the following dataset:
Names Category
Jack 1
Jack 1
Jack 1
Tom 0
Tom 0
Sara 0
Sara 0
what I am looking for is the following:
Category Number
0 2
1 1
that is, the number of unique values in column Names per each category.
I can get the number of unique values in the first column:
length(unique(df$Names))
and the total repeated number of categories in the second column:
length(which(df$Category== 1))
but this is not the result i am looking for.