x + y x - y x * y x / y x ^ y x %% y x %/% y
+
for addition, -
for
subtraction *
for multiplication, /
for division and
^
for exponentiation.
%%
indicates x mod y
and %/%
indicates integer
division. It is guaranteed that x == (x %% y) + y * ( x %/% y )
unless y == 0
where the result is NA
or
NaN
(depending on the typeof
of the arguments).
Objects such as arrays or time-series can be operated on this way provided they are conformable.
Math
for miscellaneous and Special
for special
mathematical functions.x <- -1:12 x + 1 2 * x + 3 x %% 2 #-- is periodic x %/% 5