6.1 Arithmetic operators
R is a programming language with a statistics focus. While it can be used for very complex tasks, it can also be used as a simple calculator, as shown previously.
The following arithmetic operators can be used for these tasks:
Operator | Function |
---|---|
+ | addition |
- | subtraction |
/ | division |
* | multiplication |
^ or ** | exponential |
In the R terminal, as you have seen before, you can type the following:
And hit Enter for R to interpret the command, and give you the output.
Then try the following:
or: