I have a dataset like this and i want to calculate the average of values in column covered_percentage. I need to combined the duplicate region into one row, while calculating the mean over the covered_Percentage column. This the short file but i have a large file with the same dataset. How to do this thing in R into large dataset.
region values covered_Percentage
ref|OR4F5 583 96.84
ref|OR4F5 339 100.00
ens|ENST00000455207 0 0.00
ref|SAMD11 120 100.00
ref|SAMD11 198 100.00
ref|NOC2L 202 100.00
ref|NOC2L 120 100.00
ref|ATP7B 120 99.17
ref|ATP7B 290 99.66
ref|ATP7B 206 99.52
I am expecting the ouput like this:
region average
ref|OR4F5 98.42
ens|ENST00000455207 0.00
ref|SAMD11 100.00
ref|NOC2L 100.00
ref|ATP7B 99.45