I have a data set where I'm trying to find the mean, minimum and maximum mass of each gang, and my code is as follows:
mass <- Gangs$Mass_kg
mass.summary <- ddply(Gangs, ~Gang_affiliation, summarise,
minimum = min(mass),
mean = mean(mass),
maximum = max(mass))
It outputs as:
Gang_affiliation minimum mean maximum
18th Street 86 92 114
Aryan Brotherhood 86 92 114
Black Guerillas 86 92 114
But what I really want is for every affiliation to have their own result.
Gang_affiliation minimum mean maximum
18th Street 86 92 114
Aryan Brotherhood 84 98 121
Black Guerillas 87 95 127
Can someone help me?