<div dir="ltr"><div>André, boa tarde!</div><div><br></div><div>Não sei se já conseguiu resolver... mas segue mais uma ideia!</div><div><br></div><div><font face="courier new, monospace">###<code r></font></div><div><font face="courier new, monospace">f <- function(vec, iter, lim) {</font></div>
<div><font face="courier new, monospace"> # (vec)tor, (iter)ações e (lim)ite superior</font></div><div><font face="courier new, monospace"> print(vec)</font></div><div><font face="courier new, monospace"> for (i in 1:iter) {</font></div>
<div><font face="courier new, monospace"> vec = vec+1</font></div><div><font face="courier new, monospace"> over = which(vec>=lim)</font></div><div><font face="courier new, monospace"> vec[over] <- vec[over]-lim</font></div>
<div><font face="courier new, monospace"> print(vec)}}</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">x1 <- c(1,2,5,6)</font></div><div><font face="courier new, monospace">x2 <- c(0,1,5,6,9,12,15,16,18,19) </font></div>
<div><font face="courier new, monospace">f(x1, 10, 10)</font></div><div><font face="courier new, monospace">f(x1, 12, 8)</font></div><div><font face="courier new, monospace">f(x2, 20, 20)</font></div><div><font face="courier new, monospace">###</code></font></div>
<div class="gmail_extra"><br clear="all"><div><div dir="ltr">Éder Comunello <<a href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>> <br>
Dourados, MS - [22 16.5'S, 54 49'W]<br></div></div>
<br><br></div></div>