View source: R/min_max_scaler.R
min_max_scale | R Documentation |
Scales the values to a range with MinMax scaling.
min_max_scale(
x,
new_min,
new_max,
old_min = NULL,
old_max = NULL,
na.rm = FALSE
)
x |
Numeric |
new_min |
Minimum value of target range. |
new_max |
Maximum value of target range. |
old_min |
Minimum value of original range. If |
old_max |
Maximum value of original range. If |
na.rm |
Whether missing values should be removed when calculating N.B. Ignored when both |
Scaled version of `x`
.
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
Other scaling functions:
to_unit_length()
# Attach packages
library(rearrr)
# Set seed
set.seed(1)
# Create numeric vector
x <- runif(10)
# Scale
min_max_scale(x, new_min = -1, new_max = 0)
min_max_scale(x, new_min = -1, new_max = 0, old_max = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.