Basic math in R

Using R for the calculator is like buying a plane ticket to get free peanuts. But I have done my taxes in R, so…

2 + 2 # addition
[1] 4
5 - 2 # subtraction
[1] 3
0.5 * 6 # multiplication
[1] 3
3 / 4 # division
[1] 0.75
sqrt(2) # square root
[1] 1.414214
4 ^ 2 # exponent
[1] 16
exp(4.9) # base-e exponent
[1] 134.2898
log(7) # natural log
[1] 1.94591
abs(-6) # absolute value
[1] 6
ceiling(4.6) # round up
[1] 5
floor(4.6) # round down
[1] 4
factorial(4) # n! = n x (n-1) x ... x 2 x 1
[1] 24
choose(8, 3) # binomial coefficient (we'll get there)
[1] 56