rescale_f | R Documentation |
Rescales transformed columns in a data frame based on the transformed columns in a second data frame. The columns are rescaled by subtracting values and then dividing by values.
rescale_f(
data,
data2 = data,
transform = list(),
subtract = list(),
divide_by = list()
)
data |
The data frame to rescale. |
data2 |
A data frame to use for the rescaling. |
transform |
A named list where the name(s) indicate the function(s) to use for the transformations and the elements indicate the columns to transform. |
subtract |
A named list where the name(s) indicate the function(s) to use when determining the value to subtract and the elements indicate the columns. |
divide_by |
A named list where the name(s) indicate the function(s) to use when determining the value to divide by and the elements indicate the columns. |
The data frame with transformed and rescaled columns.
rescale
rescale_f(datasets::mtcars,
transform = list(log = "mpg"),
subtract = list(mean = c("mpg", "disp"), min = "gear"),
divide_by = list(sd = c("mpg", "hp"))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.