powered by
This script provides transformation functions for data scaling and normalization.
trans_ratio(x, method = c("sd", "mad"))trans_root(x, fracRoot = 0.5)trans_log(x, base = 10, shift = 1)
trans_root(x, fracRoot = 0.5)
trans_log(x, base = 10, shift = 1)
A numeric vector where values are divided by the chosen method's statistic.
A numeric vector of transformed values.
A numeric vector or column of a dataframe to be transformed.
Character string specifying the method: "sd" (standard deviation) or "mad" (median absolute deviation).
The fractional power to which each element in x should be raised. Defaults to 0.5 (square root).
x
The base of the logarithm. Defaults to 10.
A numeric value added to x before applying the logarithm to avoid log(0). Defaults to 1.
trans_ratio(c(1, 2, 3, 4, 5), method = "sd") trans_root(c(1, 4, 9, 16), fracRoot = 0.5) trans_log(c(1, 10, 100, 1000), base = 10, shift = 1)
Run the code above in your browser using DataLab