log computes logarithms, by default natural logarithms,
log10 computes common (i.e., base 10) logarithms, and
log2 computes binary (i.e., base 2) logarithms. The general form
log(x, base) computes logarithms with base
log1p(x) computes log(1+x) accurately also for |x| << 1 (and less accurately when x is approximately -1).
exp computes the exponential function.
expm1(x) computes exp(x) - 1 accurately also for |x| << 1.
log(x, base = exp(1)) logb(x, base = exp(1)) log10(x) log2(x) log1p(x) exp(x) expm1(x)
- a numeric or complex vector.
- a positive or complex number: the base with respect to which logarithms are computed. Defaults to e=
log2 are only convenience wrappers, but logs to bases 10 and 2 (whether computed via
log or the wrappers) will be computed more efficiently and accurately where supported by the OS. Methods can be set for them individually (and otherwise methods for
log will be used).
log are primitive functions.
For complex inputs to the log functions, the value is a complex number with imaginary part in the range [-pi, pi]: which end of the range is used might be platform-specific.
Note that this means that the S4 generic for
log has a signature with only one argument,
x, but that
base can be passed to methods (but will not be used for method selection). On the other hand, if you only set a method for the
Math group generic then
base argument of
log will be ignored for your class.
Chambers, J. M. (1998) Programming with Data. A Guide to the S Language. Springer. (for
Documentation reproduced from R 3.0.1. License: GPL-2.