rescale: The rescaling module

rescalingR Documentation

The rescaling module

Description

The rescale module changes the scale of the variable(s) using one of the available rescaling functions: rescale_zscore(), rescale_minmax(), and rescale_center.

Usage

rescaling(data, ...)

rescale_zscore(var, na.rm = TRUE)

rescale_minmax(var, min = NULL, max = NULL, na.rm = TRUE, censor = TRUE)

rescale_center(var, na.rm = TRUE)

Arguments

data

an index table object, see [tidyindex::init()]

...

used in rescaling, a rescaling object of class rescale, currently one of the rescale_zscore(), rescale_minmax(), and rescale_center(),

var

the variable(s) to rescale, accept tidyselect syntax

na.rm

used in rescale_*(), logical, whether to remove NAs

min, max

used in rescale_minmax(), the minimum and maximum value

censor

used in rescale_minmax(), logical; whether to censor points outside min and max, if provided

Value

an index table object

Examples

dt <- hdi |> init()
dt |> rescaling(life_exp = rescale_zscore(life_exp))
dt |> rescaling(life_exp2 = rescale_minmax(life_exp, min = 20, max = 85))

tidyindex documentation built on Nov. 16, 2023, 5:08 p.m.