r - aggregate over multiple columns -
this question has answer here:
hey have data looks this:
expnum compound peak tau ss 1 100 30 50 2 145 23 45 3 b 78 45 56 4 b 45 43 23 5 c 344 23 56
id fund mean based on compound name have
norm_table$norm_peak = (aggregate(data[[3]],by=list(compound),fun=normalization))
this fine , have coding repeating 3 times changing data[[x]] number. lapply work here? or loop?
a dplyr
solution:
library(dplyr) data %>% group_by(compound) %>% summarize_each(funs(mean), -expnum)
Comments
Post a Comment