rescale_f: Rescale Transformed Data

View source: R/rescale-f.R

rescale_fR Documentation

Rescale Transformed Data

Description

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.

Usage

rescale_f(
  data,
  data2 = data,
  transform = list(),
  subtract = list(),
  divide_by = list()
)

Arguments

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.

Value

The data frame with transformed and rescaled columns.

See Also

rescale

Examples

rescale_f(datasets::mtcars,
  transform = list(log = "mpg"),
  subtract = list(mean = c("mpg", "disp"), min = "gear"),
  divide_by = list(sd = c("mpg", "hp")))

poissonconsulting/rescale documentation built on June 10, 2022, 5:22 p.m.