minmax_scaling: Rescale values using min-max scaling

Description Usage Arguments Value Author(s) Examples

View source: R/minmax-scaling.R

Description

Applies a rescaling that linearly transforms the values into a specified range of values.

Usage

1
minmax_scaling(values, lower = 0, upper = 1)

Arguments

values

A numeric vector of values

lower, upper

The lower and upper bounds of the range that the values are mapped onto

Value

A numeric vector that contains the rescaled values

Author(s)

Mathias Isaksen mathiasleanderi@gmail.com

Examples

1
2
3
4
5
6
7
8
set.seed(123)
# Generate values from normal distribution
original.values = rnorm(100, -4, 5)
# The values lie between approximately -15.5 and 7
hist(original.values)
# Rescale values to the interval [0, 1]
rescaled.values = minmax_scaling(original.values)
hist(rescaled.values)

mathiasisaksen/artKIT documentation built on Dec. 21, 2021, 2:52 p.m.