stdize: Standardize Variable

View source: R/stdize.R

stdizeR Documentation

Standardize Variable

Description

Standardize Variable

Usage

stdize(variable, to, condition, na.rm = TRUE)

Arguments

variable

Unquoted name of variable to standardize

condition

Logical vector (TRUE or FALSE) used to subset compare variable before calculating mean and standard deviation.

na.rm

Option to remove NA's when calculating mean and standard deviation. Set to TRUE by default. Note that all values will be NA in the standardized variable if set to FALSE.

compare

Variable to use to calculate mean and standard deviation from

Value

A vector with the standardized variable

Examples


var <- rnorm(100, mean = 0.5, sd = 1)

var_std <- stdize(var)

summary(var_std)


graemeblair/stdidx documentation built on April 19, 2023, 6:48 a.m.