What does %% Operator indicate in R Language

r

#1

What is the meaning of the %% Operator. I am unable to understand how it works.
I just tried to evaluate some random examples with the same but couldn’t find it. Can anyone please explain how is this %% Operator working in R without any symbol in between?

a <- c(1,2,3,4,5,6)
b <- c(4,5)
d <- b %% a
d
[1] 0 1 1 1 4 5
b <- c(1)
d
[1] 0 1 1 1 4 5
d <- a %% b
d
[1] 0 0 0 0 0 0


#2

Hi,

%% gives Remainder
%/% gives Quotient

So 6 %% 4 = 2

In your example b %% a , it will vectorised over the values in “a”