Skip to content
Prev 264189 / 398502 Next

aggregating data

oops last reply was only half the solution:

library(plyr)
df <- data.frame(gene=c('A', 'A', 'E', 'A', 'F', 'F'), probe = c(1,2,3,4,5,6), exp = c(0.34, 0.21, 0.11, 0.21, 0.56, 0.81))

ddply(df, .(gene), function(df)c(length(df$gene), median(df$exp))

  gene V1    V2
1    A  3 0.210
2    E  1 0.110
3    F  2 0.685

best

iain
--- On Thu, 30/6/11, Max Mariasegaram <max.mariasegaram at qut.edu.au> wrote: