Performs transformation on continuous variables for the heatmap color scales.

scale_norm(x, trans_type = c("percentize", "normalize", "scale", "none"))

Arguments

x

Numeric vector.

trans_type

Character string of 'normalize', 'scale' or 'none'. If 'scale', subtract the mean and divide by the standard deviation. If 'normalize', i.e., max-min normalize, subtract the min and divide by the max. If 'none', no transformation is applied. More information on what transformation to choose can be acquired here: https://cran.rstudio.com/package=heatmaply/vignettes/heatmaply.html#data-transformation-scaling-normalize-and-percentize

Value

Numeric vector of the transformed `x`.

Examples

scale_norm(1:5)
#> [1] 0.2 0.4 0.6 0.8 1.0
scale_norm(1:5, 'normalize')
#> [1] 0.00 0.25 0.50 0.75 1.00