I have this df
df<-data.frame(category=c("food","clothes","clothes","food"),item=c("bread","shirt","shoes","fish"),number=c(2,5,8,3))
and I need to sum the value of the items in the greater sets of "food" and "clothes" in order to get a table like the following.
tot<-data.frame(category=c("food","clothes"),number=c(5,13))
How can I do it?
Thank you