R/e_log_shift.R
e_log_shift.Rd
Default min_add
values:
If specified, use that.
All positive, add 0.
Min is 0, add the minimum non-0 value.
Min is negative and max is positive, add the minimum non-0 value (so minimum is now the previous non-0 value).
Max is negative, add the minimum value plus 1 so log2(x)=0
is the minimum value.
e_log_shift(x, min_add = NULL, base_log = 2)
numeric vector
value to add to x before taking log, if not specified and min(x) <= 0, then this is determined automatically
base for log
numeric vector with attributes
e_log_shift(x = c(0, 1, 2, 3), min_add = 1)
#> [1] 0.000000 1.000000 1.584963 2.000000
#> attr(,"e_log_shift")
#> min_add base_log
#> 1 2
e_log_shift(x = c(0, 10, 100, 1000), base = 10)
#> [1] 1.000000 1.301030 2.041393 3.004321
#> attr(,"e_log_shift")
#> min_add base_log
#> 10 10
e_log_shift(x = c(-4, -2, 0, 2, 4))
#> [1] 1.000000 2.000000 2.584963 3.000000 3.321928
#> attr(,"e_log_shift")
#> min_add base_log
#> 6 2