View source: R/cluster_means.R
cluster_means | R Documentation |
This function computes the mean of a single or a range of specified variable/s within each cluster.
cluster_means(data, .cols, .id_cluster, .suffix = "_cl")
data |
A data frame. |
.cols |
< |
.id_cluster |
< |
.suffix |
Optional. A string to be added to the original variable name/s to label the new column/s for the cluster means. The default is the suffix "_cl". |
An tibble containing the new cluster means indicated by the suffix
specified in .suffix
.
# Compute cluster means at the school level for mathematics
cluster_means(data = studach, .cols = math, .id_cluster = id_sch, .suffix = "_sch")
# Compute cluster means at the classroom level for mathematics and reading
cluster_means(data = studach, .cols = math:read, .id_cluster = id_cla, .suffix = "_cla")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.