R aggregate 按照某一列分组对其他列求均值

 colnames(info_matrix) <- paste0("V",1:dim(info_matrix)[2])
  spot_label <- as.numeric(spot_label)
  info_matrix <- cbind(info_matrix,spot_label)
  info_matrix <- as.data.frame(info_matrix)
  attach(info_matrix)
  tm <- aggregate(info_matrix, by=list(spot_label = info_matrix$spot_label), FUN=mean)
原文地址:https://www.cnblogs.com/shanyr/p/14620203.html