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! ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.