Learn R Programming

psycCleaning (version 0.1.1)

z_scored_group_mean: 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)

Value

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

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

Examples

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

Run the code above in your browser using DataLab