## Using R as a pocket calculator

___ + ___
___ - ___
___ / ___
___ * ___
View Interactive Version

R is a programming language mainly developed for statistics and data analysis. Within R you can use mathematical operators just like you would use on a calculator. For example, you can add + and subtract - numbers from each other:

Input
5 + 5
Output
[1] 10
Input
7 - 3.5
Output
[1] 3.5

Similarly, you can multiply * or divide / numbers:

Input
5 * 7
Output
[1] 35
Input
8 / 4
Output
[1] 2

You can take the power of a number by using the ^ sign:

Input
2 ^ 3
Output
[1] 8

According to the rules of mathematics, you can use round brackets to specify the order of evaluation in more complex tasks:

Input
5 * (2 + 4 / 2)
Output
[1] 20
Use basic operators