<div dir="ltr"><div dir="ltr"><div>Olá, Angélica</div><div><br></div><div>Você tem mais alguma restrição sobre esses números? O código abaixo gera 4 números que somam 100 segundo uma distribuição uniforme.</div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">qtd_observacoes <- 10<br><br>qtd_numeros <- 4<br><br>df <- data.frame(col1=double(qtd_observacoes),<br> col2=double(qtd_observacoes),<br> col3=double(qtd_observacoes),<br> col4=double(qtd_observacoes))<br><br>for (i in 1:qtd_observacoes) {<br> soma = 0;<br> <br> for(j in 1:(qtd_numeros-1)) {<br> valor = runif(1, 0, (100-soma))<br> df[i,j] <- valor<br> soma = soma + valor<br> }<br> df[i,qtd_numeros] <- 100 - soma<br>}<br></span><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Atenciosamente,<br></font></div><font face="verdana, sans-serif">Rodrigo de Castro Ângelo</font></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter, 12 de mar de 2019 às 10:33, Angélica Ricarte por (R-br) <<a href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">Prezados, bom dia.</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)"><br>
</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">Por gentileza, peço ajuda para simular 4 números de forma que a soma dê 100, como na tabela abaixo, por exemplo. Qual o comando e/ou pacote posso utilizar?</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)"><br>
</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)"> Comun. Execul. Planej. Analis. TOTAL</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A1 21,26 20,45 28,74 29,55 100</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A2</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A3</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A4</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A5</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A6</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A7</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A8</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A9</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">A10</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)"><br>
</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">Grata, aguardo retorno.</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)"><br>
</div>
<div style="font-family:Georgia,serif;font-size:12pt;color:rgb(0,0,0)">Att.</div>
<div id="gmail-m_-4693445675825614115signature">
<div></div>
<div></div>
<div id="gmail-m_-4693445675825614115divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="font-size:12pt;margin-top:0px;margin-bottom:0px;text-align:center"><b></b></p>
<p id="gmail-m_-4693445675825614115geom_inter_1544731489960_98_49" style="font-size:16px;margin-top:0px;margin-bottom:0px;text-align:left;font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<b><span style="font-size:12pt">Angélica Ricarte da Silva Batista</span></b></p>
<p style="font-size:16px;margin-top:0px;margin-bottom:0px;font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;text-align:center">
</p>
<div style="font-size:16px;font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-4693445675825614115geom_inter_1544731494011_21_58" style="text-align:left"><span style="font-size:10pt">Autarquia Educacional do Belo Jardim/Faculdade do Belo Jardim - AEB/FBJ</span></div>
<div id="gmail-m_-4693445675825614115geom_inter_1544731338329_47_40" style="text-align:left"><span style="font-size:11pt"><span><span style="font-size:10pt">Rodovia PE-166, Km 05 - BR, Belo Jardim - PE</span></span><br>
</span></div>
<div id="gmail-m_-4693445675825614115geom_inter_1544731493010_32_54" style="text-align:left"><span style="font-size:11pt"><span><span style="font-size:10pt">Telefone/Phone: +55 (81) 3726-1800</span><br>
</span></span></div>
<span style="font-size:10pt"></span><span style="font-size:11pt"></span></div>
<span style="font-size:10pt"></span><span style="font-size:11pt"></span><span style="font-size:10pt"></span>
<p style="font-size:16px;margin-top:0px;margin-bottom:0px;font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;text-align:center">
<span style="font-size:10pt"></span><span style="font-size:11pt"></span></p>
<span style="font-size:10pt"></span><span style="font-size:11pt"></span><span style="font-size:10pt"></span>
<p id="gmail-m_-4693445675825614115geom_inter_1544731489960_35_50" style="margin-top:0px;margin-bottom:0px;text-align:left;font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:13.3333px"><a href="http://lattes.cnpq.br/0601801978475226" title="http://lattes.cnpq.br/0601801978475226" target="_blank">CV</a></span></p>
<p style="font-size:12pt;margin-top:0px;margin-bottom:0px;text-align:center"><a href="http://lattes.cnpq.br/0601801978475226" target="_blank"></a></p>
</div>
</div>
</div>
_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="noreferrer" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="noreferrer" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</blockquote></div>