<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px"><div dir="ltr" id="yui_3_16_0_1_1421689531871_24776"><span id="yui_3_16_0_1_1421689531871_24802">Simone,</span></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_24777"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720"><span id="yui_3_16_0_1_1421689531871_23721">Você pode inverter a ordem das variáveis:</span></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720">aggregate(producao ~ dia_ciclo + n_vaca, a21, mean)</div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720"><br></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720">ou então reordenar via 'order':</div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720"><br></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720">a22 <- aggregate(producao ~ n_vaca + dia_ciclo, a21, mean)<br></div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720">a22[with(a22, order(n_vaca, dia_ciclo)), ]</div><div dir="ltr" id="yui_3_16_0_1_1421689531871_23720"><br></div> <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 13px;" id="yui_3_16_0_1_1421689531871_23620"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1421689531871_23619"> <div dir="ltr" id="yui_3_16_0_1_1421689531871_23618"> <hr size="1" id="yui_3_16_0_1_1421689531871_24828"> <font size="2" face="Arial" id="yui_3_16_0_1_1421689531871_23621"> <b><span style="font-weight:bold;">De:</span></b> Simone D. Sartorio <sisartorio@yahoo.com.br><br> <b><span style="font-weight: bold;">Para:</span></b> Rubem Kaipper Ceratti <rubem_ceratti@yahoo.com.br>; "r-br@listas.c3sl.ufpr.br" <r-br@listas.c3sl.ufpr.br> <br> <b><span style="font-weight: bold;">Enviadas:</span></b> Segunda-feira, 19 de Janeiro de 2015 16:55<br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: [R-br] Ajuda com a criação de um looping<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_1_1421689531871_23622"><br><div id="yiv7130271199"><div id="yui_3_16_0_1_1421689531871_23624"><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12px;" id="yui_3_16_0_1_1421689531871_23623"><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2990">Nossa, valeu mesmo Rubem!</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2991"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2992">Deu certo! Só precisa fazer um ajuste em relação a ordem cronológica do "dia_ciclo", pois gostaria que ficasse seguida toda a informação da mesma vaca, para só depois passar para a seguinte....será que tem algum argumento que daria para colocar na função que faça isso? você sabe?</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2992"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2992">obrigada! ;)</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2992">Si</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421693778499_2993"><br clear="none"></div><div class="yiv7130271199signature"><div style="background-color:transparent;font-style:normal;font-family:'Times New Roman';color:rgb(0, 0, 0);font-size:3px;font-weight:bold;"><b><font size="3" face="Times New Roman"><font color="#bf00bf" size="1"><span style="font-family:'times new roman';"><i></i></span></font></font></b></div></div> <div class="yiv7130271199qtdSeparateBR" id="yui_3_16_0_1_1421689531871_23650"><br clear="none"><br clear="none"></div><div class="yiv7130271199yqt5401418056" id="yiv7130271199yqt65789"><div class="yiv7130271199yahoo_quoted" style="display: block;" id="yui_3_16_0_1_1421689531871_23649"> <div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12px;" id="yui_3_16_0_1_1421689531871_23648"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;" id="yui_3_16_0_1_1421689531871_23647"> <div dir="ltr" id="yui_3_16_0_1_1421689531871_23646"> <font size="2" face="Arial" id="yui_3_16_0_1_1421689531871_24783"> Em Segunda-feira, 19 de Janeiro de 2015 16:31, Rubem Kaipper Ceratti <rubem_ceratti@yahoo.com.br> escreveu:<br clear="none"> </font> </div> <br clear="none"><br clear="none"> <div class="yiv7130271199y_msg_container" id="yui_3_16_0_1_1421689531871_24786"><div id="yiv7130271199"><div id="yui_3_16_0_1_1421689531871_24785"><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px;" id="yui_3_16_0_1_1421689531871_24784"><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254"><span id="yiv7130271199yui_3_16_0_1_1421689531871_15278">Falha minha:</span></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254"><span><br clear="none"></span></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254">aggregate(producao ~ n_vaca + dia_ciclo, a21, mean)<span><br clear="none"></span></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15254">*Acho* que está tudo certo agora...</div><br clear="none"> <div class="yiv7130271199yqt8574229625" id="yiv7130271199yqt86825"><div id="yiv7130271199yui_3_16_0_1_1421689531871_15257" style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px;"> <div id="yiv7130271199yui_3_16_0_1_1421689531871_15256" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15255"> <hr id="yiv7130271199yui_3_16_0_1_1421689531871_15276" size="1"> <font id="yiv7130271199yui_3_16_0_1_1421689531871_15258" size="2" face="Arial"> <b><span style="font-weight:bold;">De:</span></b> Simone D. Sartorio <sisartorio@yahoo.com.br><br clear="none"> <b><span style="font-weight:bold;">Para:</span></b> Rubem Kaipper Ceratti <rubem_ceratti@yahoo.com.br>; "r-br@listas.c3sl.ufpr.br" <r-br@listas.c3sl.ufpr.br> <br clear="none"> <b><span style="font-weight:bold;">Enviadas:</span></b> Segunda-feira, 19 de Janeiro de 2015 16:29<br clear="none"> <b><span style="font-weight:bold;">Assunto:</span></b> Re: [R-br] Ajuda com a criação de um looping<br clear="none"> </font> </div> <div class="yiv7130271199y_msg_container" id="yiv7130271199yui_3_16_0_1_1421689531871_15259"><br clear="none"><div id="yiv7130271199"><div id="yiv7130271199yui_3_16_0_1_1421689531871_15261"><div id="yiv7130271199yui_3_16_0_1_1421689531871_15260" style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12px;"><div id="yiv7130271199yui_3_16_0_1_1421690433290_28115">Rubem, mas eu preciso das médias por vaca e por dia do ciclo e não a média geral!</div><div id="yiv7130271199yui_3_16_0_1_1421690433290_28115"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_28115">Como poderia usar essa função?! Pelo que entendi ela tem a mesma função do tapply()</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_28115"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_28115">obrigada</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_28115">Si</div> <div class="yiv7130271199qtdSeparateBR" id="yiv7130271199yui_3_16_0_1_1421689531871_15262"><br clear="none"><br clear="none"></div><div class="yiv7130271199yqt2207253055" id="yiv7130271199yqt12240"><div class="yiv7130271199yahoo_quoted" id="yiv7130271199yui_3_16_0_1_1421689531871_15267" style="display:block;"> <div id="yiv7130271199yui_3_16_0_1_1421689531871_15266" style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12px;"> <div id="yiv7130271199yui_3_16_0_1_1421689531871_15265" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_15264"> <font id="yiv7130271199yui_3_16_0_1_1421689531871_15263" size="2" face="Arial"> Em Segunda-feira, 19 de Janeiro de 2015 16:22, Rubem Kaipper Ceratti <rubem_ceratti@yahoo.com.br> escreveu:<br clear="none"> </font> </div> <br clear="none"><br clear="none"> <div class="yiv7130271199y_msg_container" id="yiv7130271199yui_3_16_0_1_1421689531871_15270"><div id="yiv7130271199"><div id="yiv7130271199yui_3_16_0_1_1421689531871_15269"><div id="yiv7130271199yui_3_16_0_1_1421689531871_15268" style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px;"><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524">Nesse caso, talvez seja melhor usa a função 'aggregate':</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524">aggregate(producao ~ dia_ciclo, a21, mean)</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524"><br clear="none"></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524">Att.,</div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9524">Rubem</div><br clear="none"> <div id="yiv7130271199yui_3_16_0_1_1421689531871_9527" style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px;"> <div id="yiv7130271199yui_3_16_0_1_1421689531871_9526" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="yiv7130271199yqt6063048791" id="yiv7130271199yqt54735"><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421689531871_9525"> <hr size="1"> <font id="yiv7130271199yui_3_16_0_1_1421689531871_9528" size="2" face="Arial"> <b><span style="font-weight:bold;">De:</span></b> Simone D. Sartorio <sisartorio@yahoo.com.br><br clear="none"> <b><span style="font-weight:bold;">Para:</span></b> "r-br@listas.c3sl.ufpr.br" <r-br@listas.c3sl.ufpr.br> <br clear="none"> <b><span style="font-weight:bold;">Enviadas:</span></b> Segunda-feira, 19 de Janeiro de 2015 16:12<br clear="none"> <b><span style="font-weight:bold;">Assunto:</span></b> [R-br] Ajuda com a criação de um looping<br clear="none"> </font> </div> <div class="yiv7130271199y_msg_container" id="yiv7130271199yui_3_16_0_1_1421689531871_9529"><br clear="none"><div id="yiv7130271199"><div id="yiv7130271199yui_3_16_0_1_1421689531871_9531"><div id="yiv7130271199yui_3_16_0_1_1421689531871_9530" style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12px;"><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806"><span id="yiv7130271199yui_3_16_0_1_1421690433290_2895">Pessoal, preciso de uma ajuda...</span></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806"><span><br clear="none"></span></div><div dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806"><span id="yiv7130271199yui_3_16_0_1_1421690433290_3227">Meus dados são esses "a21", nele tenho a observação de 219 vacas (n_vaca), que estão numeradas de maneira aleatória. As vacas foram separadas em 3 grupos, onde em cada grupo aplicaram um tratamento diferente. Esse tratamento foi aplicado em forma de injeções (17 injeções) e entre uma injeção e outra, temos 14 dias de intervalo. A variável de interesse é "producao"</span></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">> head(a21)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""> n_vaca n_lactacao trat pri_multiparas n_injecao dia_ciclo dia_exp producao saude</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">8 1731 3 1 2 0 1 -13 45.1 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">9 1731 3 1 2 0 2 -12 47.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">10 1731 3 1 2 0 3 -11 45.5 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">11 1731 3 1 2 0 4 -10 45.2 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">12 1731 3 1 2 0 5 -9 47.4 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">13 1731 3 1 2 0 6 -8 48.3 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""># Aqui estou criando um subconjunto, onde tenho todas as informações da vaca 1731:</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">> (vaca1731<- subset(a21, a21$n_vaca==1731)); dim(vaca1731)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""> n_vaca n_lactacao trat pri_multiparas n_injecao dia_ciclo dia_exp producao saude</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">8 1731 3 1 2 0 1 -13 45.1 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">9 1731 3 1 2 0 2 -12 47.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">10 1731 3 1 2 0 3 -11 45.5 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">11 1731 3 1 2 0 4 -10 45.2 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">12 1731 3 1 2 0 5 -9 47.4 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">13 1731 3 1 2 0 6 -8 48.3 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">14 1731 3 1 2 0 7 -7 46.4 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">15 1731 3 1 2 0 8 -6 47.9 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">16 1731 3 1 2 0 9 -5 50.3 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">17 1731 3 1 2 0 10 -4 50.8 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">18 1731 3 1 2 0 11 -3 47.9 enrollment</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">19 1731 3 1 2 0 12 -2 46.2 heat</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">20 1731 3 1 2 0 13 -1 50.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">21 1731 3 1 2 0 14 0 45.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">22 1731 3 1 2 1 1 1 50.5 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">23 1731 3 1 2 1 2 2 49.0 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">24 1731 3 1 2 1 3 3 48.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">25 1731 3 1 2 1 4 4 53.9 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">26 1731 3 1 2 1 5 5 45.4 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">27 1731 3 1 2 1 6 6 38.6 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">28 1731 3 1 2 1 7 7 41.3 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">29 1731 3 1 2 1 8 8 50.2 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">30 1731 3 1 2 1 9 9 50.2 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">31 1731 3 1 2 1 10 10 50.4 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">32 1731 3 1 2 1 11 11 49.9 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">33 1731 3 1 2 1 12 12 50.1 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">34 1731 3 1 2 1 13 13 52.0 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">35 1731 3 1 2 1 14 14 47.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">36 1731 3 1 2 2 1 15 50.0 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">37 1731 3 1 2 2 2 16 49.7 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">38 1731 3 1 2 2 3 17 50.4 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">39 1731 3 1 2 2 4 18 48.9 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">40 1731 3 1 2 2 5 19 49.5 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">41 1731 3 1 2 2 6 20 48.8 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">42 1731 3 1 2 2 7 21 56.3 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">43 1731 3 1 2 2 8 22 52.1 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">44 1731 3 1 2 2 9 23 51.6 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">45 1731 3 1 2 2 10 24 50.5 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">46 1731 3 1 2 2 11 25 46.0 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">47 1731 3 1 2 2 12 26 53.7 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">48 1731 3 1 2 2 13 27 51.7 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">49 1731 3 1 2 2 14 28 49.1 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">50 1731 3 1 2 3 1 29 51.9 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">51 1731 3 1 2 3 2 30 51.4 healthy</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">...</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">256 1731 3 1 2 17 11 235 21.2 lamness</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">257 1731 3 1 2 17 12 236 19.4 lamness</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">258 1731 3 1 2 17 13 237 23.5 lamness</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">259 1731 3 1 2 17 14 238 19.9 lamness</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">[1] 251 9</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""># Para simplificar, considere que temos apenas 10 vacas:</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">#--------------------------------------------</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">> vacas <- c(1731, 2090, 2652, 2945, 2946, 3246, 3413, 3593, 3878, 3882) # é a numeração das vacas</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""># O que eu quero fazer com esses dados é o seguinte:</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v1<- subset(a21, a21$n_vaca==vacas[1]); dim(v1)<br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v2<- subset(a21, a21$n_vaca==vacas[2]); dim(v2)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v3<- subset(a21, a21$n_vaca==vacas[3]); dim(v3)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v4<- subset(a21, a21$n_vaca==vacas[4]); dim(v4)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v5<- subset(a21, a21$n_vaca==vacas[5]); dim(v5)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v6<- subset(a21, a21$n_vaca==vacas[6]); dim(v6)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v7<- subset(a21, a21$n_vaca==vacas[7]); dim(v7)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v8<- subset(a21, a21$n_vaca==vacas[8]); dim(v8)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v9<- subset(a21, a21$n_vaca==vacas[9]); dim(v9)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">v10<- subset(a21, a21$n_vaca==vacas[10]); dim(v10)</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none" class="yiv7130271199" style=""></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">b<- c(</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v1$producao, v1$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v2$producao, v2$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v3$producao, v3$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v4$producao, v4$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v5$producao, v5$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v6$producao, v6$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v7$producao, v7$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v8$producao, v8$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v9$producao, v9$dia_ciclo, mean),</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">tapply(v10$producao, v10$dia_ciclo, mean))</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">#--------------------------------------------</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">Ainda estou engatinhando em questão de programação no R, como poderia fazer um looping com essas linhas de comando, pois preciso fazer isso para as 219 vacas!</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style=""><br clear="none"></div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">desde já, muito obrigada!</div><div class="yiv7130271199" dir="ltr" id="yiv7130271199yui_3_16_0_1_1421690433290_2806" style="">Simone</div><div></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2807"> </div><div class="yiv7130271199signature" id="yiv7130271199yui_3_16_0_1_1421690433290_2812"><div id="yiv7130271199yui_3_16_0_1_1421690433290_2811"><i id="yiv7130271199yui_3_16_0_1_1421690433290_2810"><b id="yiv7130271199yui_3_16_0_1_1421690433290_2809"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2808" size="3" face="times new roman, new york, times, serif">***---***---***---***---***---***---***---***---***---***---***---***---***</font></b></i></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2816" style="background-color:transparent;font-style:normal;font-family:'times new roman', 'new york', times, serif;color:rgb(0, 0, 0);font-size:3px;font-weight:bold;"><i id="yiv7130271199yui_3_16_0_1_1421690433290_2815"><b id="yiv7130271199yui_3_16_0_1_1421690433290_2814"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2813" size="3" face="times new roman, new york, times, serif">* Simone Daniela Sartorio</font></b></i></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2817"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2818" face="times new roman, new york, times, serif">* <span class="yiv7130271199Apple-tab-span" style="white-space:pre;"> </span>Professora Adjunta I no CCA/UFSCar, Araras/SP.</font></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2820"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2819" face="times new roman, new york, times, serif">*<span class="yiv7130271199Apple-tab-span" style="white-space:pre;"> </span>Doutora e Mestre em Estatística e Experimentação Agronômica - ESALQ/USP.</font></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2857"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2859" face="times new roman, new york, times, serif">* <span class="yiv7130271199Apple-tab-span" style="white-space:pre;"> </span>Licenciada em Matemática - UNESP/Rio Claro.</font></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2858"><b id="yiv7130271199yui_3_16_0_1_1421690433290_2872" style="font-family:'times new roman', 'new york', times, serif;font-size:13px;line-height:1.22;background-color:transparent;"><i id="yiv7130271199yui_3_16_0_1_1421690433290_2871"><font id="yiv7130271199yui_3_16_0_1_1421690433290_2870" size="3" face="Times New Roman">***---***---***---***---***---***---***---***---***---***---***---***---***</font></i></b><br clear="none"></div><div id="yiv7130271199yui_3_16_0_1_1421690433290_2955" style="background-color:transparent;font-style:normal;font-family:'Times New Roman';color:rgb(0, 0, 0);font-size:3px;font-weight:bold;"><b id="yiv7130271199yui_3_16_0_1_1421690433290_2954"><font size="3" face="Times New Roman"><font color="#bf00bf" size="1"><span style="font-family:'times new roman';"><i></i></span></font></font></b><div id="yiv7130271199yui_3_16_0_1_1421690433290_2953"><b><font id="yiv7130271199yui_3_16_0_1_1421690433290_2952" size="3" face="Times New Roman"><i id="yiv7130271199yui_3_16_0_1_1421690433290_2951"><span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2950"><span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2949"><var id="yiv7130271199yui-ie-cursor"></var> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2948"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2947"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2946"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2945"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2944"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2943"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2942"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2941"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2940"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2939"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2938"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2937"> <span class="yiv7130271199tab" id="yiv7130271199yui_3_16_0_1_1421690433290_2936"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> <span class="yiv7130271199tab"> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>Tenha um bom dia! </i><font face="Courier New, courier, monaco, monospace, sans-serif">;)</font></font></b></div><b></b></div></div></div></div></div><br clear="none">_______________________________________________<br clear="none">R-br mailing list<br clear="none"><a rel="nofollow" shape="rect" class="yiv7130271199removed-link removed-link" href="">R-br@listas.c3sl.ufpr.br</a><br clear="none"><a rel="nofollow" shape="rect" class="yiv7130271199removed-link removed-link" href="">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br clear="none">Leia o guia de postagem (<a rel="nofollow" shape="rect" class="yiv7130271199removed-link removed-link" href="">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br clear="none"><br clear="none"></div></div> </div> </div> </div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div><br clear="none"><br clear="none"></div> </div> </div></div> </div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div><br><br></div> </div> </div> </div></body></html>