1

I'm quite new to R and I've been wondering if there is a way to perform modular arithmetic, either in base R or any package, I have not found anything/thought of anything so far.

If it is not clear what i mean by modular arithmetic, i mean something like, if you have set/module like c(1,2,3,4,5), if you add 7 to 1, you would end up with a two, so it sorta wraps around. I've been coping with the lack of this kind of operation by using if statements, adding special conditions for numbers that go above the max number un a module/set, but right now i'm in the need of performing actual modular arithmetic.

I hope this isn't a too much of a open ended question.

Thanks in advance!

0 Answers0