scale_minmax {dynutils} | R Documentation |
Rescale data to a [0, 1] range
Description
Rescale data to a [0, 1] range
Usage
scale_minmax(x)
Arguments
x |
A numeric vector, matrix or data frame. |
Value
The centered, scaled matrix or vector. The numeric centering and scalings used are returned as attributes.
Examples
## Generate a matrix from a normal distribution
## with a large standard deviation, centered at c(5, 5)
x <- matrix(rnorm(200*2, sd = 10, mean = 5), ncol = 2)
## Minmax scale the data
x_scaled <- scale_minmax(x)
## Plot rescaled data
plot(x_scaled)
## Show ranges of each column
apply(x_scaled, 2, range)
[Package dynutils version 1.0.11 Index]