<div dir="ltr"><div><div><div><div><div><div><div><div>Edmar,<br><br></div>Alternativa não testada:<br><br></div>> plyr::ddply(hospital, plyr::.(paciente), summarize,<br></div> first = min(data_int, na.rm = TRUE),<br></div> last = max(data_int, na.rm = TRUE),<br></div> valor = mean(valor_int, na.rm = TRUE))<br><br></div>Espero ter ajudado.<br><br></div>att,<br></div>FH<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-24 10:36 GMT-06:00 Edmar Caldas via R-br <span dir="ltr"><<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:13px"><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386"><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386"><span><br></span></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386"><span id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38482">Estou com um arquivo neste formato.</span></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386"><span><br></span></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><img class="m_-5401298826024182768ymail-preserve-class m_-5401298826024182768inline-image-guid-410c1851-0d93-7723-1ba9-49839e5b21b7 m_-5401298826024182768rte-inline-saved-image" src="cid:92af2cbd-f559-09a7-cf8d-c102ba4fb9eb@yahoo.com" alt="Alinhar imagem" style="width:100%;max-width:283px;max-height:215px" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38483"></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr">Estou querendo agregar por paciente. Informando a média da coluna valor_int e quero também pegar a menor e a maior data da coluna data_int.Quero que o arquivo fique assim;</div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><img class="m_-5401298826024182768ymail-preserve-class m_-5401298826024182768inline-image-guid-f6bab553-557d-ec77-b321-5ad86186c671 m_-5401298826024182768rte-inline-saved-image m_-5401298826024182768img-overlay-selected" src="cid:6456206d-5ac4-062e-8624-1620ea5bbe8e@yahoo.com" alt="Alinhar imagem" style="width:100%;max-width:579px;max-height:309px" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39083"><br><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39160"><br id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39163"></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39165"><br id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39168"></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr">Desenvolvi esse codigo.</div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><img class="m_-5401298826024182768ymail-preserve-class m_-5401298826024182768inline-image-guid-cd609d20-f9cd-7471-300f-5f0c06a7dfe4 m_-5401298826024182768rte-inline-saved-image" src="cid:a8f25844-4cf4-7199-84ad-8de287d1fc15@yahoo.com" alt="Alinhar imagem" style="width:100%;max-width:569px;max-height:241px" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39511"><br><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285">agora estou tentando colocar as datas.</div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><img class="m_-5401298826024182768ymail-preserve-class m_-5401298826024182768inline-image-guid-c7c421ae-5f76-8a9f-424b-42b1652cffa1 m_-5401298826024182768rte-inline-saved-image" src="cid:74fdc16a-f745-2bb8-727a-5a09a4cd2721@yahoo.com" alt="Alinhar imagem" style="width:100%;max-width:706px;max-height:98px" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_40049"><span class="HOEnZb"><font color="#888888"><br id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_40050"><br id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_40051"></font></span></div><span class="HOEnZb"><font color="#888888"><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39285"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39286"><br></div><div dir="ltr" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39286"><br></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38386" dir="ltr"><span><br></span></div><div></div><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38385"> </div><div class="m_-5401298826024182768signature" id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38384"><div id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_38383"><font id="m_-5401298826024182768yui_3_16_0_ym19_1_1490361917476_39157" color="#0000ff">Edmar</font></div></div></font></span></div></div><br>______________________________<wbr>_________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">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/<wbr>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-<wbr>guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>