What is the double percentage sign (%%) mean in R -


what double percent (%%) used in r?

from using it, looks if divides number in front number in of many times can , returns left on value. correct?

out of curiosity, when useful?

the "arithmetic operators" page (which can via ?"%%") says

‘%%’ indicates ‘x mod y’

which helpful if you've done enough programming know referring modular division, i.e. integer-divide x y , return remainder. useful in many, many, many applications. example (from @gavinsimpson in comments), %% useful if running loop , want print kind of progress indicator screen every nth iteration (e.g. use if (i %% 10 != 0) { #do something} every 10th iteration).

since %% works floating-point numbers in r, i've dug example if (any(wts %% 1 != 0)) used test of wts values non-integer.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -