I have a data.frame that looks like this:
data.frame
# set example data df <- read.table(textConnection(\"item\\tsize\
Here is the solution using the ddply from plyr package:
ddply
library(plyr) ddply(df,.(item),colwise(mean)) item size weight value 1 A 2 3 5 2 B 1 2 3 3 C 3 2 1