I have a data.frame that looks like this:
data.frame
# set example data df <- read.table(textConnection(\"item\\tsize\
df$value <- ave(df$value,df$item,FUN=mean) df[!duplicated(df$item),] item size weight value 1 A 2 3 5 3 B 1 2 3 4 C 3 2 1