rowGrpSums | R Documentation |
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).
rowGrpSums(x, grp, na.rm = TRUE)
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 |
This function a matrix with row/group sum values
rowGrpMeans
, rowGrpSds
, rowSds
, colSums
set.seed(2016); dat1 <- matrix(c(runif(200) +rep(1:10,20)), ncol=10)
head(rowGrpMeans(dat1, gr=gl(4, 3, labels=LETTERS[1:4])[2:11]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.