standardize {qacBase}R Documentation

Standardize numeric variables

Description

Standardize the numeric variables in a data frame

Usage

standardize(data, mean = 0, sd = 1, include_dummy = FALSE)

Arguments

data

a data frame.

mean

mean of the transformed variables.

sd

standard deviation of the transformed variables.

include_dummy

logical. If TRUE, transform dummy coded (0,1) variables.

Details

standardize transforms all the numeric variables in a data frame to have the same mean and standard deviation. By default, this will be a mean of 0 and standard deviation of 1. Character variables and factors are left unchanged. By default, dummy coded variables are also left unchanged. Use include_dummy=TRUE to transform these variables as well.

Value

a data frame

Examples

head(cars74)

cars74_st <- standardize(cars74)
head(cars74_st)

[Package qacBase version 1.0.3 Index]