<html><head></head><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px">Muito obrigado Cesar e Ivan. A todos os listeiros um bom dia!!!<br><div id="yui_3_16_0_ym19_1_1486468400563_5727"><span></span></div><div id="yui_3_16_0_ym19_1_1486468400563_5728"> </div><div class="signature" id="yui_3_16_0_ym19_1_1486468400563_5850">Edson Lira <br>Estatístico<br>Manaus-Amazonas</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: times new roman, new york, times, serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Em Segunda-feira, 6 de Fevereiro de 2017 19:02, Cesar Rabak <cesar.rabak@gmail.com> escreveu:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv0062934561"><div><div dir="ltr">Edson,<div><br clear="none"></div><div>Não sabendo exatamente para quê você necessita a diferença, talvez lhe convenha ter este aditamento:</div><div><br clear="none"></div><div>a diferença após a conversão das cadeias de caracteres com strptime() pode ser feita diretamente:</div><div>> hht[2]- hht[1]</div><div><span style="font-size:12.8px;">Time difference of 30 mins</span><br clear="none"></div><div><span style="font-size:12.8px;">se você quiser apenas o valor numérico, pode-se obtê-lo por:</span></div><div><span style="font-size:12.8px;">> as.double(hht[2]- hht[1])</span><br clear="none"></div><div><span style="font-size:12.8px;">30</span></div><div><span style="font-size:12.8px;">se as unidades forem importantes:</span></div><div><div><span style="font-size:12.8px;">> units(hht[2]- hht[1])</span></div><div><span style="font-size:12.8px;">[1] "mins"</span></div><div style="font-size:12.8px;"><br clear="none"></div><div style="font-size:12.8px;">Ademais, se você quiser "normalizar" as unidades, para evitar o seguinte:</div></div><div><div style="font-size:12.8px;"><br clear="none"></div><div style="font-size:12.8px;">hh <- c("10:00","11:30")</div><div style="font-size:12.8px;">hht <- strptime(hh, format = '%H:%M', 'GMT')</div><div style="font-size:12.8px;">as.double(hht[2] - hht[1])</div><div style="font-size:12.8px;">1.5</div><div style="font-size:12.8px;">units(<span style="font-size:12.8px;">(hht[2] - hht[1])</span></div><div style="font-size:12.8px;"><span style="font-size:12.8px;">"hours"</span></div><div style="font-size:12.8px;"><span style="font-size:12.8px;"><br clear="none"></span></div><div style="font-size:12.8px;"><span style="font-size:12.8px;">você pode fazer</span></div><div><span style="font-size:12.8px;">as.numeric(</span><span style="font-size:12.8px;">hht[2] - hht[1]</span><span style="font-size:12.8px;">, units="mins")</span></div></div><div><span style="font-size:12.8px;">90</span></div><div><span style="font-size:12.8px;"><br clear="none"></span></div><div><span style="font-size:12.8px;">HTH</span></div><div><span style="font-size:12.8px;">--</span></div><div><span style="font-size:12.8px;">Cesar Rabak</span></div><div><span style="font-size:12.8px;"><br clear="none"></span></div></div><div class="yiv0062934561gmail_extra"><br clear="none"><div class="yiv0062934561gmail_quote">2017-02-06 15:44 GMT-02:00 Luis Iván Ortiz Valencia via R-br <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:r-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>></span>:<br clear="none"><blockquote class="yiv0062934561gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div>hh <- c("09:20","09:50")</div><div>hht <- strptime(hh, format = '%H:%M', 'GMT')</div><div>difftime(hht[2],hht[1])</div><div>Time difference of 30 mins<br clear="none"></div></div><div class="yiv0062934561gmail_extra"><br clear="none"><div class="yiv0062934561gmail_quote"><div><div class="yiv0062934561h5">2017-02-06 12:00 GMT-02:00 Edson Lira via R-br <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:r-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>></span>:<br clear="none"></div></div><blockquote class="yiv0062934561gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="yiv0062934561h5"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:16px;"><div id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9706"><span id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9798">Bom dia listeiros, tenho esse banco:</span></div><div dir="ltr" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9955"><span id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9798"></span><br clear="none">
<table class="yahoo-compose-table-card"><colgroup id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9902" span="1"><col id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9903" style="width:56pt;" span="2" width="75"><col id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9904" style="width:47pt;" span="1" width="63"><col id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9905" style="width:44pt;" span="1" width="59"></colgroup><tbody id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9906"><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9907" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9908" style="min-height:15.0pt;width:56pt;" height="20" width="75">dt_sol</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9909" style="width:56pt;" width="75">dt_atend</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9910" style="width:47pt;" width="63">hora_ent</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9911" style="width:44pt;" width="59">hora_sai</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9912" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9913" style="min-height:15.0pt;" height="20" align="right">01/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9914" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9915" align="right">09:20</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9916" align="right">09:50</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9917" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9918" style="min-height:15.0pt;" height="20" align="right">01/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9919" align="right">03/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9920" align="right">09:00</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9921" align="right">10:44</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9922" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9923" style="min-height:15.0pt;" height="20" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9924" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9925" align="right">09:30</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9926" align="right">11:00</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9927" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9928" style="min-height:15.0pt;" height="20" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9929" align="right">05/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9930" align="right">10:00</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9931" align="right">12:00</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9932" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9933" style="min-height:15.0pt;" height="20" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9934" align="right">12/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9935" align="right">10:30</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9936" align="right">12:00</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9937" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9938" style="min-height:15.0pt;" height="20" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9939" align="right">16/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9940" align="right">10:00</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9941" align="right">11:30</td></tr><tr id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9942" style="min-height:15.0pt;" height="20"><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9943" style="min-height:15.0pt;" height="20" align="right">02/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9944" align="right">18/02/2016</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9945" align="right">09:30</td><td colspan="1" rowspan="1" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9946" align="right">10:16</td></tr></tbody></table></div><div id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9803"><span id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9798"><br clear="none"></span></div><div id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9980"><span id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9798">As variáveis hora_ent e hora_saida como fator. Gostaria de calcular a diferença entre o tempo da entrada para a saída</span></div><div id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9712"> </div><div class="yiv0062934561m_8098076504788108832m_3834509374340703483signature" id="yiv0062934561m_8098076504788108832m_3834509374340703483yui_3_16_0_ym19_1_1486385149810_9983">Edson Lira <br clear="none">Estatístico<br clear="none"> Manaus-Amazonas</div></div></div><br clear="none"></div></div>______________________________ _________________<br clear="none">
R-br mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">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" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-g uia</a>) e forneça código mínimo reproduzível.<span class="yiv0062934561HOEnZb"><font color="#888888"><br clear="none"></font></span></blockquote></div><span class="yiv0062934561HOEnZb"><font color="#888888"><br clear="none"><br clear="all"></font></span><div><br clear="none"></div>-- <br clear="none"><div class="yiv0062934561m_8098076504788108832gmail_signature"><div dir="ltr"><div>Luis Iván Ortiz Valencia<br clear="none">Doutor Saúde Pública - Epidemiologia, IESC, UFRJ<br clear="none">Estatístico Msc.<br clear="none">Spatial Analyst Msc.<div class="yiv0062934561yqt0274056845" id="yiv0062934561yqtfd50417"><br clear="none"><br clear="none"></div></div></div></div><div class="yiv0062934561yqt0274056845" id="yiv0062934561yqtfd00401">
</div></div><div class="yiv0062934561yqt0274056845" id="yiv0062934561yqtfd90870">
<br clear="none">______________________________ _________________<br clear="none">
R-br mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">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" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br- guia</a>) e forneça código mínimo reproduzível.<br clear="none"></div></blockquote></div><div class="yiv0062934561yqt0274056845" id="yiv0062934561yqtfd80490"><br clear="none"></div></div></div></div><br><br></div> </div> </div> </div></div></body></html>