I came across below code
v <- c( 2,5.5,6)
t <- c(8, 3, 4)
print(v/t)
print(v%/%t)
In what way 3rd and 4th lines of code are different?
/ does the usual division.
Regarding %/%, the documentation states:
%%indicatesx mod yand%/%indicates integer division. It is guaranteed thatx == (x %% y) + y * ( x %/% y )(up to rounding error) unlessy == 0[…]
To find the documentation for such operators, enter the following on the R console:
help("%/%")
Both are arithmetic operators. The first one is division, the second is integer division. See here: https://www.statmethods.net/management/operators.html
> 10/3
[1] 3.333333
> 10%/%3
[1] 3
In addition, there is also modulus division (x %% y)
> 10%%3
[1] 1
That's all I know about division operators :-)
/is division while%/%is integer division