Description Usage Arguments Value See Also Examples
This function standardises numeric variables of a given data. There are three methods; range standardisation, normalisation standardisation, and median absolute deviation standardisation. Range standardisation standardises the numeric variables to a specified range, the default is [0, 1]. Normalisation standardisation standardises the numeric variables to have mean 0 and standard deviation 1. Median Absolute Devation standardisation standardises the numeric variables to have median 0 and median absolute deviation 1.
1 2 | standardise_variables(dataset, method = c("range", "norm", "MAD"),
lower_bound = 0, upper_bound = 1, file_name = NULL, directory = NULL)
|
dataset |
A dataset to be standardised, the dataset can have mixed types. |
method |
A charactor object denoting the method of standardisation used. One of three possible options; "range", "norm", "MAD". |
lower_bound |
The lower bound of the range standardisation, default is 0. |
upper_bound |
The upper bound of the range standardisation, default is 1. |
file_name |
A character object indicating the file name when saving the data frame. The default is NULL. The name must include the .csv suffixs. |
directory |
A character object specifying the directory where the data frame is to be saved as a .csv file. |
Outputs the standardised dataset as data frame.
remove_variables
, derive_variables
, extract_variables
, impute_variables
, transform_variables
1 2 3 4 5 6 7 8 9 | # Example Data
x1 <- rnorm(n = 60, mean = 50, sd = 10)
x2 <- rpois(n = 60, lambda = 50)
x3 <- sample(x = 1:10, size = 60, replace = TRUE)
# Standardise the Numeric Variables
standardise_x(dataset = x1, method = "range")
standardise_x(dataset = iris, method = "range", lower_bound = 10, upper_bound = 100)
standardise_x(dataset = x2, method = "norm")
standardise_x(dataset = x3, method = "MAD")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.