Inspired by edgeR::sumTechReps and base::rowsum(), this function
takes the average of the values in each group given by the group argument
for each row of the data matrix.
Examples
# Specify the Group levels
Group <- gl(n = 2, k = 3, labels = c("DMSO", "THZ1"))
# Take the average of every gene by treatment group
by_group <- colmean(GSE161650_lc, group = Group)
by_group[1:5, ]
#>             DMSO       THZ1
#> A1BG   5.3591868  6.7678862
#> AAAS   3.7607083  3.8849627
#> AACS   2.2630657  3.5369248
#> AADAT -0.0950194 -0.6603692
#> AAED1  1.6294052  1.8470007