[BioC] Average based on group
Fabrice Tourre
fabrice.ciup at gmail.com
Thu May 12 17:20:07 CEST 2011
Dear list,
I have dataframe, the second column is groups factor, each group has
10 items. The data as fellow.
chr10 rs9971029 71916552 0.1
chr10 rs9971029 71916553 0.4
chr10 rs9971029 71916554 0.3
chr10 rs9971029 71916555 0.9
chr10 rs9971029 71916556 1
chr10 rs9971029 71916557 2
chr10 rs9971029 71916558 4
chr10 rs9971029 71916559 0.8
chr10 rs9971029 71916560 0.9
chr10 rs9971029 71916561 0.8
chr10 rs9971030 71916726 0.6
chr10 rs9971030 71916727 0.5
chr10 rs9971030 71916728 0.4
chr10 rs9971030 71916729 0.7
chr10 rs9971030 71916730 0
chr10 rs9971030 71916731 0
chr10 rs9971030 71916732 0.6
chr10 rs9971030 71916733 0.8
chr10 rs9971030 71916734 0.9
chr10 rs9971030 71916735 1
I want to get a average of each item based on the group factor. So at
last I want to get a vector which length is 10.
The value calculated as this:
(0.1+0.6)/2
(0.4+0.5)/2
…
(0.8+1)/2
Thank you very much in advance.
More information about the Bioconductor
mailing list