[BioC] Average based on group

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu May 12 18:20:04 CEST 2011


Sorry -- my mental R parser was broken, I missed a closing parenthesis.

Instead of:

R> library(data.table)
R> dt <- data.table(df, key='snp.id')
R> avg <- dt[, list(avg=mean(score), by=snp.id]

That last line should be:

R> avg <- dt[, list(avg=mean(score)), by=snp.id]

or

R> avg <- dt[, list(avg=.Internal(mean(score))), by=snp.id]

-steve


-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list