Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

log_trans

Log transformations


Description

  • log_trans(): log(x)

  • log1p(): log(x + 1)

  • pseudo_log_trans(): smoothly transition to linear scale around 0.

Usage

log_trans(base = exp(1))

log10_trans()

log2_trans()

log1p_trans()

pseudo_log_trans(sigma = 1, base = exp(1))

Arguments

base

base of logarithm

sigma

Scaling factor for the linear part of pseudo-log transformation.

Examples

plot(log2_trans(), xlim = c(0, 5))
plot(log_trans(), xlim = c(0, 5))
plot(log10_trans(), xlim = c(0, 5))

plot(log_trans(), xlim = c(0, 2))
plot(log1p_trans(), xlim = c(-1, 1))

# The pseudo-log is defined for all real numbers
plot(pseudo_log_trans(), xlim = c(-5, 5))
lines(log_trans(), xlim = c(0, 5), col = "red")

# For large positives nubmers it's very close to log
plot(pseudo_log_trans(), xlim = c(1, 20))
lines(log_trans(), xlim = c(1, 20), col = "red")

scales

Scale Functions for Visualization

v1.1.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Dana Seidel [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.