My data set looks like this
df<-read.table(text="group, race
1, 1
1, 1
1, 4
2, 1
2, 3
2, 4
3, 1
2, 1
1, 1", header=T, sep=",")
I would like to get the sum of the count of each race BY each group. I have tried using the aggregate function but to no avail
I hope to have output that looks something like this:
group race total
1 1 2
1 4 1
2 1 2
.
.
.
3 1 1