[R] Recoding in R conditioned on a certain value.
Kate Ignatius
kate.ignatius at gmail.com
Sat Apr 5 18:51:30 CEST 2014
I'm trying to work out the average of a certain value by chromosome.
I've done the following, but it doesn't seem to work:
Say, I want to find average AD for chromosome 1 only and paste the
value next to all the positions on chromosome 1:
sam$mmad[sam$chrom == '1'] <-
(sam$ad)/(colSums(sam[c(1:nrow(sam$chrom=='1'))],))
I know this is convoluted and possible wrong... but I would like to do
this for all chromosomes.
Thanks!
More information about the R-help
mailing list