[R] How to pool a group of samples and take the ave.

affy snp affysnp at gmail.com
Mon Nov 12 19:37:26 CET 2007


Dear list,

Hi! I have a table A, 238304 rows and 243 columns (representing
samples). First of all, I would like to pool a group of samples
from 48th column to 243rd column and take the average across
them and make a single column,saying as the reference column.

Second, I want to use each column of first 47 columns in table
A divided by the reference column and end up with a new table
B with 238304 rows and 47 columns.

Is there any simple code which especially could do sth like
       reference_column<-(A[,48]+A[,49]+...A[,243])/196
and B<-A[,1:47]/reference_column?

Thank you very much for your help!

Best,
      Allen



More information about the R-help mailing list