z_scored_group_mean {psycCleaning}R Documentation

Z scored with with respect to the group mean

Description

This function will compute group-mean-centered scores, and then z-scored the group-mean-centered scores with respect to the grand mean.

Usage

z_scored_group_mean(data, cols, group, keep_original = TRUE)

Arguments

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

Value

return a dataframe with the columns z-scored (replace existing columns)

Examples

z_scored_group_mean(iris, dplyr::ends_with("Petal.Width"), "Species")

[Package psycCleaning version 0.1.1 Index]