I have a data frame for example:
gene1 gene2 gene3 group
sample1 1 2 4 1
sample2 2 3 4 1
sample3 3 4 4 1
sample4 4 5 4 2
sample5 5 6 4 2
I want to calculate the average of each group, and put the result into a new data frame, like below:
group gene1 gene2 gene3
1 2 3 4
2 4.5 5.5 4
How can I realize it?
Thank you very much.