This function allows you to scale vectors or an entire data frame using the max-min scaling method A numeric vector is always returned.

maxmin(x)

Arguments

x

Pass a vector or the required columns of a data frame through this argument.

Value

Returns a numeric vector with the input rescaled.

Details

This is used within keymetrics_scan() to enable row-wise heatmapping. Originally implemented in https://github.com/martinctc/surveytoolbox.

Examples

numbers <- c(15, 40, 10, 2)
maxmin(numbers)
#> [1] 0.3421053 1.0000000 0.2105263 0.0000000