rowGrpSums: rowSums with destinction of groups (of columns, eg groups of replicates)
Description
This function calculates row-sums for matrix with multiple groups of data, ie similar to rowSums but one summed value for each line and group of data.
Groups are specified as columns of 'x' in 'grp' (so length of grp should match number of columns of 'x', NAs are allowed).
Usage
rowGrpSums(x, grp, na.rm = TRUE)
Value
This function a matrix with row/group sum values
Arguments
x
matrix or data.frame
grp
(character or factor) defining which columns should be grouped (considered as replicates)
na.rm
(logical) a logical value indicating whether NA-values should be stripped before the computation proceeds.