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)

 

posted on 2021-04-06 08:51  若流芳千古  阅读(323)  评论(0编辑  收藏  举报

导航