Center or standardize variables in a data frame
scale_df(dataset, center = TRUE, scale = TRUE, sf = 2, wts = NULL, calc = TRUE)
dataset | Data frame |
---|---|
center | Center data (TRUE or FALSE) |
scale | Scale data (TRUE or FALSE) |
sf | Scaling factor (default is 2) |
wts | Weights to use (default is NULL for no weights) |
calc | Calculate mean and sd or use attributes attached to dat |
Scaled data frame
copy_attr
to copy attributes from a training to a test dataset