<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Caros senhores,<div><br></div><div>tenho um loop com o seguinte formato:</div><div><br></div><div>While (condição) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>for (i in 1:n) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>calculo</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #020202">X2sum</span> = sum(<span style="color: #020202">X2</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3">print(<span style="color: #020202">X2sum</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #020202">dfreedom</span> = <span style="color: #c38806">function</span>(<span style="color: #020202">x</span>) (nrow(<span style="color: #020202">x</span>)*(nrow(<span style="color: #020202">x</span>) - <span style="color: #010101">1</span>))/<span style="color: #010101">2</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #020202">df</span> = dfreedom(<span style="color: #020202">X2</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3">print(<span style="color: #020202">df</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #020202">pvalue</span> = <span style="color: #010101">1</span> - pchisq(sum(<span style="color: #020202">X2</span>), dfreedom(<span style="color: #020202">X2</span>))</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3">print(<span style="color: #020202">pvalue</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; color: rgb(2, 2, 2); "><font class="Apple-style-span" face="Helvetica" size="3">NAnumber<span style="color: #000000"> = nrow(</span>pop<span style="color: #000000">[,</span>counter<span style="color: #000000">:(</span>counter<span style="color: #fff6ff"> </span><span style="color: #000000">+</span><span style="color: #fff6ff"> </span><span style="color: #010101">1</span><span style="color: #000000">)]) - nrow(FrmNA(</span>pop<span style="color: #000000">[,</span>counter<span style="color: #000000">:(</span>counter<span style="color: #fff6ff"> </span><span style="color: #000000">+</span><span style="color: #fff6ff"> </span><span style="color: #010101">1</span><span style="color: #000000">)]))</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; color: rgb(2, 2, 2); "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #000000">print(</span>NAnumber<span style="color: #000000">)</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 13px/normal Monaco; color: rgb(2, 2, 2); "><font class="Apple-style-span" face="Helvetica" size="3"><span style="color: #000000">}</span></font></div>
<br></div><div>Esses objetos no final (X2sum, df, pvalue, NAnumber) não são impressos no R com o nome deles, mas do seguinte modo:</div><div>[1] resultado</div><div>[1] resultado</div><div>[1] resultado</div><div>[1] resultado</div><div><br></div><div>Como eu faço para imprimir com os nomes ao invés desses [1]?</div><div><br></div><div>Obrigado,</div><div>Vitor Aguiar</div></body></html>