Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In R what is the equivalent of "mod" function handle in Matlab?

Tags:

r

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.

like image 429
SaZa Avatar asked Jan 13 '23 15:01

SaZa


1 Answers

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

like image 118
lejlot Avatar answered Jan 30 '23 20:01

lejlot