Reputation: 311
How i can Find mod of two numbers in r? I know in MATLAB we can use "mod" but I am not sure about r. I searched the help and couldn't find mod function in r.
Upvotes: 5
Views: 15964
Reputation: 66775
There is a %%
operator
> 5 %% 1
[1] 0
> 5 %% 2
[1] 1
> 5 %% 3
[1] 2
> 5 %% 4
[1] 1
> 5 %% 5
[1] 0
> 5 %% 6
[1] 5
You can use ?'%%'
to get its detailed description
Upvotes: 10