Learn R Programming

effectsize (version 0.4.4)

change_scale: Rescale a numeric variable

Description

Rescale a numeric variable to a new range.

Usage

change_scale(x, ...)

# S3 method for numeric change_scale(x, to = c(0, 100), range = NULL, verbose = TRUE, ...)

# S3 method for grouped_df change_scale( x, select = NULL, exclude = NULL, to = c(0, 100), range = NULL, ... )

# S3 method for data.frame change_scale( x, select = NULL, exclude = NULL, to = c(0, 100), range = NULL, ... )

Arguments

x

Object.

...

Arguments passed to or from other methods.

to

New range of values of the data after rescaling.

range

Initial (old) range of values. If NULL, will take the range of data.

verbose

Toggle warnings and messages on or off.

select

Character vector of column names. If NULL (the default), all variables will be selected.

exclude

Character vector of column names to be excluded from selection.

Value

A rescaled object.

See Also

normalize() standardize() ranktransform()

Other transform utilities: normalize(), ranktransform(), standardize()

Examples

Run this code
# NOT RUN {
change_scale(c(0, 1, 5, -5, -2))
change_scale(c(0, 1, 5, -5, -2), to = c(-5, 5))

head(change_scale(trees))
# }

Run the code above in your browser using DataLab