Skip to content

Instantly share code, notes, and snippets.

@geofferyzh
Created April 17, 2012 14:30
Show Gist options
  • Save geofferyzh/2406341 to your computer and use it in GitHub Desktop.
Save geofferyzh/2406341 to your computer and use it in GitHub Desktop.
RinAction - R Functions - Math Functions
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# R in Action - Advanced Data Management #
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
#################################################
## Basic Math Functions ##
#################################################
# abs(x) -- Absolute value
# sqrt(x) -- Square root
# ceiling(x) -- ceiling(3.475) returns 4.
# floor(x) -- floor(3.475) returns 3.
# trunc(x) -- trunc(5.99) returns 5.
# round(x, digits=n) -- round(3.475, digits=2) returns 3.48.
# signif(x, digits=n ) -- signif(3.475, digits=2) returns 3.5.
# cos(x),sin(x),tan(x) -- Cosine, sine, and tangent
# acos(x),asin(x),atan(x) -- Arc-cosine, arc-sine, and arc-tangent
# cosh(x),sinh(x),tanh(x) -- Hyperbolic cosine, sine, and tangent
# acosh(x),asinh(x),atanh(x)-- Hyperbolic arc-cosine, arc-sine, and arc-tangent
# log(x,base=n) -- Logarithm of x to the base n
# log(x) -- Natural logarithm (log(10) returns 2.3026)
# log10(x) -- Common logarithm (log10(10) returns 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment