4.3 Math
A lot of mathematical operations in R are straightforward. Here are some of the basic operations we can perform:
• + and -: addition and subtraction
• * and /: multiplication and division
• **: exponents
We can perform mathematical operations on values directly:
## [1] 5
Or we can operate on variables:
## [1] 125
We can also save the output of an expression as a variable:
## [1] 20