rescale | R Documentation |
Centers and scales columns in a data frame based on the columns in a second
data frame. A column is centered by subtracting the mean and scaled by
dividing by the standard deviation. Columns in scale
are automatically
added to center
so they are standardised.
rescale(data, data2 = data, center = character(0), scale = character(0))
data |
The data frame to center and scale. |
data2 |
A data frame to use for the centering and scaling. |
center |
A character vector of the columns to center. |
scale |
A character vector of the columns to scale (after centering). |
The data frame with rescaled columns.
scale
, rescale_f
and rescale_c
rescale(datasets::mtcars, scale = "mpg")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.