Arithmetic operators is used to solve mathematical problems like addition, substraction, multiplication etc.
There are 7 types of arithmetic operators in R programming language, including:
9 + 99 + 999
## [1] 1107
999 - 99 - 9
## [1] 891
99 * 10
## [1] 990
990 / 10
## [1] 99
9 ^ 2
## [1] 81
9 %% 7
## [1] 2
9 %/% 7
## [1] 1
In computer programming language (including R), uses “precedence operators” in the calculation process.
The precedence of operators determines which operator is executed first if there is more than one operator in an expression. Example:
1 + 1 * 0
## [1] 1
The result will be different if we give paranthesis on the expression. Example:
(1 + 1) * 0
## [1] 0