I have a data.frame that looks like this:
data.frame
# set example data df <- read.table(textConnection(\"item\\tsize\
The data.table solution...
data.table
require(data.table) DT <- data.table(df) DT[ , lapply(.SD , mean ) , by = item ] item size weight value 1: A 2 3 5 2: B 1 2 3 3: C 3 2 1