Description Usage Arguments Examples
Center and scale vectors by mean/standard deviation or median/IQR with the option to base the standardization only on unique observations.
1 2 3 4 5 6 | standardize(
x,
stats = list(center = "mean", scale = "sd"),
use_unique = TRUE,
margin
)
|
x |
numeric data to standardize |
stats |
a list defining the centering and scaling statistics. |
use_unique |
use only unique values of |
margin |
passed to apply if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | x <- 1:100
standardize(x)
standardize(x, stats = list(center = "median", scale = "IQR"))
xmat <- matrix(1:50, nrow = 10)
standardize(xmat, margin = 0)
standardize(xmat, margin = 1)
standardize(xmat, margin = 2)
xarray <- array(1:60, dim = c(5, 2, 6))
standardize(xarray, margin = 0)
standardize(xarray, margin = 1:2)
# Standardize a data.frame
standardize(mtcars)
# a generic list object
alist <- list(x = rep(1:10, 2), y = rnorm(100), z = matrix(1:10, nrow = 2))
standardize(alist, margin = 0)
standardize(alist, margin = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.