Basic Mathematical Functions

April 20, 2013

(This article was first published on Analysis with R, and kindly contributed to R-bloggers)

R can perform the usual mathematical operations, below are the functions:


  • +    – addition
  •     – subtraction
  • *    – multiplication
  • /    – division


  • sin      – sine
  • cos      – cosine
  • tan      – tangent
  • asin    – sine inverse
  • acos    – cosine inverse
  • atan    – tangent inverse

Linear Algebra

  • +            – element-wise addition
  •             – element-wise subtraction
  • *            – element-wise multiplication
  • /            – element-wise division
  • %*%        – matrix multiplication
  • t            – transpose
  • eigen    – eigenvalues and eigenvectors
  • solve    – inverse of matrix
  • ginv      – generalized inverse, requires MASS package
  • rbind    – combines vectors of observations horizontally into matrix class
  • cbind    – combines vectors of observations vertically into matrix class


  1. Kabacoff, R. I. Matrix Algebra. Quick-R. Retrieved April 20, 2013 here.
  2. Trigonometric Functions. R Documentation. R.2.15.1

To leave a comment for the author, please follow the link and comment on their blog: Analysis with R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)