R has a rich set of built-in functions for performing basic numeric operations such as elementary exponential, logarithmic, root and trigonometric functions. These functions are listed below. For more details about any one of these, please visit its page.
Functions | Description |
exp() |
Returns the exponent of e. |
expm1() |
Returns the exponent of e minus 1, i.e., ex-1. |
log() |
Returns the natural logarithm (or specified base) of a given number. |
logb() |
Returns the natural logarithm (or specified base) of a given number. |
log10() |
Returns the base-10 logarithm of a given number. |
log2() |
Returns the base-2 logarithm of a given number. |
log1p() |
Returns the natural logarithm of (1+number), i.e., log(1+number). |
sqrt() |
Returns the square root of the given number. |
Functions | Description |
sin() |
Returns the trigonometric sine of an angle. |
cos() |
Returns the trigonometric cosine of an angle. |
tan() |
Returns the trigonometric tangent of an angle. |
asin() |
Returns the arc sine of a value. |
acos() |
Returns the arc cosine of a value. |
atan() |
Returns the arc tangent of a value. |
atan2() |
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). |
Functions | Description |
sinh() |
Returns the hyperbolic sine of a value. |
cosh() |
Returns the hyperbolic cosine of a value. |
tanh() |
Returns the hyperbolic tangent of a value. |
asinh() |
Returns the inverse hyperbolic sine of a value. |
acosh() |
Returns the inverse hyperbolic cosine of a value. |
atanh() |
Returns the inverse hyperbolic tangent of a value. |
Functions | Description |
ceiling() |
Rounds the given number up to the nearest integer. |
floor() |
Rounds the given number down to the nearest integer. |
trunc() |
Rounds the given number towards zero. |
round() |
Rounds the given number to specified number of decimal places (default is 0). |
signif() |
Rounds the given number to specified number of significant digits. |
Functions | Description |
abs() |
Returns the absolute (positive) value of the given number. |
factorial() |
Returns factorial of a given integer. |
gamma() |
Returns gamma function of the argument. |
lgamma() |
Returns log-gamma function of the argument. |
is.finite() |
Check if the argument is finite or not. |
is.infinite() |
Check if the argument is infinity or not. |
is.nan() |
Check if the argument is Not-a-Number (NaN) or not. |