<div dir="ltr"><div class="gmail_default"><div class="gmail_default" style="font-family:verdana,sans-serif">Uma pequena alteração para nomear as séries... </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><font face="monospace, monospace">### <code r></font></div><div class="gmail_default"><font face="monospace, monospace">res <- NULL</font></div><div class="gmail_default"><font face="monospace, monospace">for (n in c(10, 20, 30)) for (p in c(0.3, 0.4, 0.5)) {</font></div><div class="gmail_default"><font face="monospace, monospace"> id <- paste(n, p, sep="_")</font></div><div class="gmail_default"><font face="monospace, monospace"> sim <- list(rbinom(n, 1,p)); names(sim) <- id</font></div><div class="gmail_default"><font face="monospace, monospace"> res <- c(res, sim)</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">res</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### exemplo de operação com lista - cálculo das proporções</font></div><div class="gmail_default"><font face="monospace, monospace">sapply(res, function(x) sum(x)/length(x))</font></div><div class="gmail_default"><font face="monospace, monospace">## 10_0.3 10_0.4 10_0.5 20_0.3 20_0.4 20_0.5 30_0.3 30_0.4 30_0.5 </font></div><div class="gmail_default"><font face="monospace, monospace">## 0.3000000 0.3000000 0.5000000 0.3000000 0.3000000 0.4000000 0.2333333 0.4000000 0.6000000 <br></font></div><div class="gmail_default"><font face="monospace, monospace">### </code></font></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif" style="font-size:small"><div style="font-family:'trebuchet ms',sans-serif;display:inline"></div>================================================<br>Éder Comunello</font><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">PhD Student in Agricultural Systems Engineering (USP/Esalq)</span><br></div><div><span style="font-size:small">Brazilian Agricultural Research Corporation (</span><font face="arial, helvetica, sans-serif" style="font-size:small">Embrapa)</font><div style="font-size:small"><font face="arial, helvetica, sans-serif">Dourados, MS, Brazil [</font>22 16.5'S, 54 49.0'W<span style="font-family:arial,helvetica,sans-serif">]</span></div><div><div><br></div><div><br></div></div><div style="font-size:small"><br></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">Em 28 de janeiro de 2016 08:03, Éder Comunello <span dir="ltr"><<a href="mailto:comunello.eder@gmail.com" target="_blank">comunello.eder@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font face="verdana, sans-serif">Bom dia, Paulo!</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">Uma forma simples é acumular os resultados em uma lista de vetores. Posteriormente você pode operar a lista para cálculos de interesse.</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### <code r></font></div><div class="gmail_default"><font face="monospace, monospace">res <- NULL</font></div><div class="gmail_default"><font face="monospace, monospace">for (n in c(10, 20, 30)) for (p in c(0.3, 0.4, 0.5)) {</font></div><div class="gmail_default"><font face="monospace, monospace"> sim <- rbinom(n, 1,p)</font></div><div class="gmail_default"><font face="monospace, monospace"> res <- c(res, list(sim))</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">res</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### exemplo de operação com lista - cálculo das proporções</font></div><div class="gmail_default"><font face="monospace, monospace">sapply(res, function(x) sum(x)/length(x))</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">### </code></font></div></div><span class=""><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif" style="font-size:small"><div style="font-family:'trebuchet ms',sans-serif;display:inline"></div>================================================<br>Éder Comunello</font><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">PhD Student in Agricultural Systems Engineering (USP/Esalq)</span><br></div><div><span style="font-size:small">Brazilian Agricultural Research Corporation (</span><font face="arial, helvetica, sans-serif" style="font-size:small">Embrapa)</font><div style="font-size:small"><font face="arial, helvetica, sans-serif">Dourados, MS, Brazil [</font>22 16.5'S, 54 49.0'W<span style="font-family:arial,helvetica,sans-serif">]</span></div><div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></span></div>
</blockquote></div><br></div>