Learn R Programming

ck37r (version 1.0.3)

standardize: Rescale variables, possibly excluding some columns

Description

Simple extension to base::scale() to skip columns.

Usage

standardize(x, skip_vars = NULL, ...)

Arguments

x

Dataframe or matrix, assumed to have column names.

skip_vars

List of names of variables not to scale.

...

Extra arguments passed-through to base::scale

Value

Data-frame with appropriate variables scaled.

See Also

scale

Examples

Run this code
# NOT RUN {
library(ck37r)

data(Boston, package = "MASS")

# Don't scale our outcome variable.
data = standardize(Boston, skip_vars = "medv")

summary(data)

# }

Run the code above in your browser using DataLab