Description Usage Arguments Value See Also Examples
This function transforms numeric variables of a given data based on skeweness (and kurtosis criterion). There are five transformation methods; square root, log and inverse. Square root transformation transforms a numeric variable by takingthe square root of the variable. Log transformation transforms a numeric variable by taking the log of the variable. Power transformation transforms a numeric variable by taking a power p of the variable. Without the skew bounds this function acts as apply(MARGIN = 2)
1 2 | transform_variables(dataset, skew_bound = NULL, method = c("log", "power"),
p = NULL)
|
dataset |
A dataset to be transformed, the dataset can have mixed types. |
skew_bound |
A vector length two representing the lower and upper skeweness bounds. Default is NULL. |
method |
A charactor object denoting the method of transformation used. One of two possible options; "log" or "power". |
p |
The power in association with the power transformations, default is NULL |
Outputs the transformed dataset as data frame.
remove_variables
, derive_variables
, extract_variables
, impute_variables
, standardise_variables
1 2 3 4 5 6 7 8 9 10 11 | # 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)
x4 <- rep(x = c("yes", "no"), times = 30)
x5 <- rep(x = c("high", "medium", "low"), times = 20)
x6 <- sample(x = c("yes", "no"), size = 60, replace = TRUE)
# Save as a data frame
data <- as.data.frame(cbind(x1, x2, x3, x4, x5, x6))
# Transform the Numeric Variables
transformation_x(data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.