I am new to R and coding and so this might be a very obvious answer!
I have a data set with log2 values for four daphnia replicates for thousands of gene probes, corresponding to various genes (as shown in the image). However, for each replicate I want to get an average expression for each gene. Is there a way I can do this?
Here's the top of my data frame:
s_MC13_B1_Cd.Ni s_MC13_B2_Cd.Ni s_MC13_B3_Cd.Ni s_MC13_B4_Cd.Ni
[1,] "3.32737034165695" "3.30082063716602" "3.35288781669471"
"3.28130201442409"
[2,] "2.99677521546021" "2.97525202994054" "3.01357652548303"
"2.98091704146676"
[3,] "3.22057255739705" "3.24001410852619" "3.19806113996704"
"3.17850023932788"
[4,] "3.17934205285383" "3.22237873890637" "3.20299332433795"
"3.19533925098426"
[5,] "3.20285957796094" "3.22659173854477" "3.22878128735342"
"3.21307289097597"
[6,] "3.16945922109561" "3.1672329312015" "3.17366131274743"
"3.18792397254863"
[1,] "GENE:JGI_V11_100009"
[2,] "GENE:JGI_V11_100009"
[3,] "GENE:JGI_V11_100036"
[4,] "GENE:JGI_V11_100036"
[5,] "GENE:JGI_V11_100036"
[6,] "GENE:JGI_V11_100044"
Basically I want to get an average of each column for each gene (column 5) - for example i want to get an average of the first 2 rows (GENE:JGI_V11_100009) for each column, and do this for every gene in column 5