rowmean {TSCAN} | R Documentation |
A utility that is equivalent to rowsum
, but computes the mean instead of the sum of each subset of rows.
rowmean(x, group, ...)
x |
A numeric matrix or matrix-like object. |
group |
A vector or factor specifying the group assignment for each row of |
... |
Further arguments to pass to |
A numeric matrix with one row per level of group
,
where the value for each column contains the average value across the subset of rows corresponding that level.
Aaron Lun
x <- matrix(runif(100), ncol = 5) group <- sample(1:8, 20, TRUE) (xmean <- rowmean(x, group))