group_means | R Documentation |
This function computes group means for each factor level of Y in the provided data matrix X.
group_means(Y, X)
Y |
a vector of labels to compute means over disjoint sets |
X |
a data matrix from which to compute means |
a matrix with row names corresponding to factor levels of Y and column-wise means for each factor level
# Example data
X <- matrix(rnorm(50), 10, 5)
Y <- factor(rep(1:2, each = 5))
# Compute group means
gm <- group_means(Y, X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.