The get_transform() gets transformation of numeric variable.
get_transform( x, method = c("log", "sqrt", "log+1", "log+a", "1/x", "x^2", "x^3", "Box-Cox", "Yeo-Johnson") )
x | numeric. numeric for transform |
---|---|
method | character. transformation method of numeric variable |
numeric. transformed numeric vector.
The supported transformation method is follow.:
"log" : log transformation. log(x)
"log+1" : log transformation. log(x + 1). Used for values that contain 0.
"log+a" : log transformation. log(x + 1 - min(x)). Used for values that contain 0.
"sqrt" : square root transformation.
"1/x" : 1 / x transformation
"x^2" : x square transformation
"x^3" : x^3 square transformation
"Box-Cox" : Box-Box transformation
"Yeo-Johnson" : Yeo-Johnson transformation
if (FALSE) { # log+a transform get_transform(iris$Sepal.Length, "log+a") if (requireNamespace("forecast", quietly = TRUE)) { # Box-Cox transform get_transform(iris$Sepal.Length, "Box-Cox") # Yeo-Johnson transform get_transform(iris$Sepal.Length, "Yeo-Johnson") } else { cat("If you want to use this feature, you need to install the forecast package.\n") } }