ilog: Intelligently take logarithms

Description Usage Arguments Value See Also Examples

View source: R/ilog.R

Description

Deals with zero values when taking logarithms by adding 'value' to all observations before taking logarithms. By default, 'value' is the minimum non-zero value.

Usage

1
ilog(x, value = min_value(x), ...)

Arguments

x

A numeric vector

value

A numeric indicating the value to add to x before taking logs. Default is the smallest positive value of x.

...

Values passed on to log, e.g. base

Value

A numeric vector, typically the logarithm of x

See Also

log, iexp, min_value

Examples

1
2
3
4
ilog(1:2)             # Returns log(1:2)
ilog(-2:2)            # Returns an error due to negative values
ilog(0:2)             # Returns log(0:2+1)
ilog(-2:2, value = 3) # Returns log(-2:2 + 3)

jarad/ilog documentation built on May 18, 2019, 3:45 p.m.