Note that modulus and remainder are not the same in case either a or b is negative. If you work with negative numbers, modulus is always non-negative (it matches the sign of the divisor).
Arguments
- a
Dividend
- b
Divisor
See also
Other custom:
%REM%()
,
contains_IM()
,
expit()
,
filter_IM()
,
indexof()
,
length_IM()
,
logistic()
,
logit()
,
mod()
,
rbool()
,
rdist()
,
round_IM()
,
shuffle()
,
substr_i()
Examples
a <- 7
b <- 3
rem(a, b)
#> [1] 1
mod(a, b)
#> [1] 1
a <- -7
b <- 3
rem(a, b)
#> [1] -1
mod(a, b)
#> [1] 2
a <- 7
b <- -3
rem(a, b)
#> [1] 1
mod(a, b)
#> [1] -2
a <- -7
b <- -3
rem(a, b)
#> [1] -1
mod(a, b)
#> [1] -1