Learn R Programming

iNZightTools (version 1.13.0)

standardizeVars: Standardize the data of a numeric variable

Description

Centre then divide by the standard error of the values in a numeric variable

Usage

standardizeVars(.data, vars, names = paste(sep = ".", vars, "std"))

Value

the original dataframe containing new columns of the standardized variables with tidyverse code attached

Arguments

.data

a dataframe with the columns to standardize

vars

a character vector of the numeric variables in .data to standardize

names

names for the created variables

Author

Owen Jin, Tom Elliott

See Also

code

Examples

Run this code
standardized <- standardizeVars(iris, var = c("Sepal.Width", "Petal.Width"))
cat(code(standardized))
head(standardized)

Run the code above in your browser using DataLab