powered by
Modulo operator.
mod(n, m)
numeric vector (preferably of integers)
integer vector (positive, zero, or negative)
a numeric (integer) value or vector/matrix
mod(n, m) is the modulo operator and returns \(n\,mod\,m\). mod(n, 0) is n, and the result always has the same sign as m.
mod(n, 0)
n
m
rem, div
rem
div
# NOT RUN { mod(c(-5:5), 5) mod(c(-5:5), -5) mod(0, 1) #=> 0 mod(1, 0) #=> 1 # }
Run the code above in your browser using DataLab