| scale_numeric | R Documentation |
scales a numeric vector
scale_numeric(x, xmin = min(x, na.rm = TRUE), xmax = max(x, na.rm = TRUE))
x |
the numeric vector to scale |
xmin |
the minimum value used for the scaling. all all x < xmin are set to 0 |
xmax |
the maximum value used for the scaling. all x > xmax set to 1 |
a numeric vector of the same length as x, with all values between 0 and 1, except for NAs which are unchanged
x <- c(0.1, 100, -2.5, 20, 78.2, NA)
scaled <- scale_numeric(x)
all(is.na(scaled) | (scaled >= 0 & scaled <= 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.