On the Help page "Arithmetic Operators" (which can you go through ?"%%" ) is written
"%% indicates" x mod y
This is only useful if you have done enough programming to know that this relates to modular division , that is, divide the integer x by y and return the remainder. This is useful in many, many, many applications. For example (from @GavinSimpson in the comments), %% is useful if you run a loop and want to display some kind of progress indicator on the screen every nth iteration (for example, use if (i %% 10 == 0) { #do something} to do something every 10th iteration).
Since %% also works for floating-point numbers in R, I just have an if (any(wts %% 1 != 0)) example, where if (any(wts %% 1 != 0)) used to check, where any of the wts values wts not an integer.
source share