View source: R/z_scored_group_mean.R
z_scored_group_mean | R Documentation |
This function will compute group-mean-centered scores, and then z-scored the group-mean-centered scores with respect to the grand mean.
z_scored_group_mean(data, cols, group, keep_original = TRUE)
data |
A data.frame or a data.frame extension (e.g. a tibble). |
cols |
Columns that need to be centered. See 'dplyr::dplyr_tidy_select' for available options. |
group |
the grouping variable. If you need to pass multiple group variables, try to use quos(). Passing multiple group variables is not tested. |
keep_original |
default is 'FALSE'. Set to 'TRUE' to keep original columns |
return a dataframe with the columns z-scored (replace existing columns)
z_scored_group_mean(iris, dplyr::ends_with("Petal.Width"), "Species")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.