View source: R/missing_data_lm_functions.R
scale_all_variables | R Documentation |
Function to standardize all variables based on supplied mean and sd vectors
scale_all_variables(data, mean, sd)
data |
The dataset |
mean |
Vector of means. |
sd |
Vector of standard deviations |
Returns a dataset where all of the variables have been scaled.
## Not run: x <- c(1,2,3,4,5) y <- c(2.1,2.5,4,5,6) temp_data <- as.data.frame(cbind(y, x)) scale_all_variables(data=temp_data, mean=sapply(temp_data, mean), sd=sapply(temp_data, sd)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.