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
Post a Comment