Skip to contents

Computes a log-transformation of x with a small positive bias b, and an optional logarithmic base.

Usage

logbp(x, b = 1e-06, base = 10^1)

Arguments

x

A numeric vector or matrix of values to transform.

b

A small positive offset added to x before applying the logarithm. Defaults to 1e-6.

base

The base of the logarithm. Defaults to 10.

Value

A numeric vector or matrix with the log-transformed values.

Examples

logbp(1:10)
#>  [1] 4.342943e-07 3.010302e-01 4.771214e-01 6.020601e-01 6.989701e-01
#>  [6] 7.781513e-01 8.450981e-01 9.030900e-01 9.542426e-01 1.000000e+00
logbp(0, b = 1e-4)
#> [1] -4
logbp(c(0.1, 1, 10), base = exp(1))
#> [1] -2.302575e+00  9.999995e-07  2.302585e+00