Description Usage Arguments Details Value Examples
Efficiently calculates the row means or row variances or column means or columns variances of a matrix split by a factor.
1 2 3 4 | row_mean_aggregate(mat, groups)
row_var_aggregate(mat, groups)
col_mean_aggregate(mat, groups)
col_var_aggregate(mat, groups)
|
mat |
a matrix |
groups |
a factor of length ncol(mat) to split the matrix by. |
Calculates the row[column] means[variances] for columns belonging to each level of the provided groups. Uses an approach much more efficient than aggregate
. Requires at least 2 samples from each group.
a matrix of dimension nrow(mat) x length(levels(groups)) of means[variances] for each row for each group. a matrix of dimension ncol(mat) x length(levels(groups)) of means[variances] for each column for each group.
1 2 3 4 5 6 7 | groups <- c("A", "A", "B", "B", "C","C","C")
vals <- matrix(rnorm(70), ncol=7)
group_means = row_mean_aggregate(vals, groups)
group_vars = row_var_aggregate(vals, groups)
vals <- t(vals)
group_means = col_mean_aggregate(vals, groups)
group_vars = col_var_aggregate(vals, groups)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.