<div dir="ltr"><div class="gmail_default" style=""><div class="gmail_default"><font face="verdana, sans-serif">Paulo, bom dia!</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">Não consegui reproduzir o erro. Qual a saída de </font><font face="monospace, monospace">str(lista.exames)</font><font face="verdana, sans-serif">?</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><span style="font-family:monospace,monospace">### <code r></span><br></div><div class="gmail_default"><font face="monospace, monospace">lista.exames <- structure(list(id = 1:3, `Data de Liberação:` = c("10/06/2007 01:03:34", </font></div><div class="gmail_default"><font face="monospace, monospace">"10/06/2007 01:03:34", "10/06/2007 01:03:34")), .Names = c("id", "Data de Liberação:"), row.names = c(NA, </font></div><div class="gmail_default"><font face="monospace, monospace">-3L), class = "data.frame")</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">str(lista.exames)</font></div><div class="gmail_default"><font face="monospace, monospace"># 'data.frame':<span class="" style="white-space:pre"> </span>3 obs. of 2 variables:</font></div><div class="gmail_default"><font face="monospace, monospace"># $ id : int 1 2 3</font></div><div class="gmail_default"><font face="monospace, monospace"># $ Data de Liberação:: chr "10/06/2007 01:03:34" "10/06/2007 01:03:34" "10/06/2007 01:03:34"</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">class(lista.exames[,"Data de Liberação:"])</font></div><div class="gmail_default"><font face="monospace, monospace"># [1] "character"</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"><a href="http://dt.hr">dt.hr</a> <- lista.exames[,"Data de Liberação:"][1:3]; <a href="http://dt.hr">dt.hr</a></font></div><div class="gmail_default"><font face="monospace, monospace"># [1] "10/06/2007 01:03:34" "10/06/2007 01:03:34" "10/06/2007 01:03:34"</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">strptime(<a href="http://dt.hr">dt.hr</a>, format = "%d/%m/%Y %H:%M:%S", tz="America/Sao_Paulo")</font></div><div class="gmail_default"><font face="monospace, monospace"># [1] "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT"</font></div><div class="gmail_default"><font face="monospace, monospace">### </code></font></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif" style="font-size:small"><div style="font-family:'trebuchet ms',sans-serif;display:inline"></div></font><font face="arial, helvetica, sans-serif" style="font-size:12.8px"><span style="font-size:small">================================================</span><br>Éder Comunello</font><div style="font-size:12.8px"><span style="font-family:arial,helvetica,sans-serif">Agronomist (UEM), MSc in Environ. Sciences (UEM)</span><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:12.8px"><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">DSc in Agricultural Systems Engineering (USP/Esalq)</span><br></div><div><span style="font-size:small">Brazilian Agricultural Research Corporation (</span><font face="arial, helvetica, sans-serif" style="font-size:small">Embrapa)</font></div><div><div><font face="arial, helvetica, sans-serif" style="font-size:small">Dourados, MS, Brazil </font><font face="arial, helvetica, sans-serif" size="2">|<O>|</font></div><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">================================================</span><br></div></div></div><div style="font-size:small"><font face="arial, helvetica, sans-serif">GEO, </font>-22.2752, -54.8182, 408m<span style="font-family:arial,helvetica,sans-serif"><br></span></div><div style="font-size:12.8px"><span style="font-size:small;font-family:arial,helvetica,sans-serif">UTC-04:00 / DST: UTC-03:00</span></div><div><div><div><br></div><div><br></div></div><div style="font-size:small"><br></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">Em 3 de março de 2016 17:03, Paulo Nogueira Starzynski <span dir="ltr"><<a href="mailto:paulons@gmail.com" target="_blank">paulons@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Pessoal,<div>estou tentando fazer uma conversão simples de data e hora armazena em um vetor de caracters para formato <span style="font-family:'Ubuntu Mono';font-size:10.4pt;line-height:1.2;white-space:pre-wrap;color:rgb(0,0,0);background-color:rgb(225,226,229)"> "POSIXlt" "POSIXt"</span>. </div><div>Porém, está acontecendo algo que não entendo ao usar a função strptime.</div><div><br></div><div>Se eu passo o vetor com os dados diretamete, retorna NA.</div><div>Se eu copio e colo os valores na função, dá certo... ou o mesmo usando o dput, como abaixo... vejam...</div><div><br></div><div><br></div><div><div><span style="border-collapse:separate;color:rgb(0,0,0);font-family:'Ubuntu Mono';font-size:12px;border-spacing:0px;background-color:rgb(225,226,229)"><table cellspacing="0" cellpadding="0" style="padding-left:6px;padding-bottom:8px;border:none;outline:none;word-wrap:break-word;width:748px;font-style:inherit!important;font-variant:inherit!important;font-weight:inherit!important;font-stretch:inherit!important;line-height:inherit!important;font-family:inherit!important;white-space:pre-wrap!important;font-size:10.4pt!important"><tbody><tr><td align="left" style="font-family:'Ubuntu Mono';line-height:1.2;vertical-align:top;font-size:10.4pt!important"><pre style="font-family:'Ubuntu Mono';outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:10.4pt!important;white-space:pre-wrap!important"><span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue">class(lista.exames[,"Data de Liberação:"])
</span>[1] "character"
<span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue"><a href="http://dt.hr" target="_blank">dt.hr</a> <- lista.exames[,"Data de Liberação:"][1:10]
</span><span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue">strptime(<a href="http://dt.hr" target="_blank">dt.hr</a>, format = "%d/%m/%Y %H:%M:%S")
</span> [1] NA NA NA NA NA NA NA NA NA NA</pre><pre style="font-family:'Ubuntu Mono';outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:10.4pt!important;white-space:pre-wrap!important"><br></pre><pre style="font-family:'Ubuntu Mono';outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:10.4pt!important;white-space:pre-wrap!important"># não deu certo</pre><pre style="font-family:'Ubuntu Mono';outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:1.2;font-size:10.4pt!important;white-space:pre-wrap!important"><span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue">dput(lista.exames[,"Data de Liberação:"][1:10])
</span>c("10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
"10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
"10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
"10/06/2007 01:03:34")
<span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue"><a href="http://dt.hr" target="_blank">dt.hr</a> <- c("10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
</span><span style="white-space:pre-wrap;color:blue">+ </span><span style="color:blue">"10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
</span><span style="white-space:pre-wrap;color:blue">+ </span><span style="color:blue">"10/06/2007 01:03:34", "10/06/2007 01:03:34", "10/06/2007 01:03:34",
</span><span style="white-space:pre-wrap;color:blue">+ </span><span style="color:blue">"10/06/2007 01:03:34")
</span><span style="white-space:pre-wrap;color:blue">> </span><span style="color:blue">strptime(<a href="http://dt.hr" target="_blank">dt.hr</a>, format = "%d/%m/%Y %H:%M:%S")
</span> [1] "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT"
[4] "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT"
[7] "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT" "2007-06-10 01:03:34 BRT"
[10] "2007-06-10 01:03:34 BRT"
</pre></td></tr><tr><td align="left" style="font-family:'Ubuntu Mono';line-height:1.2;vertical-align:top;font-size:10.4pt!important"></td></tr><tr><td align="left" style="font-family:'Ubuntu Mono';line-height:1.2;vertical-align:top;font-size:10.4pt!important"><table cellspacing="0" cellpadding="0" style="width:748px"><tbody><tr><td align="left" width="1" height="" rowspan="1" style="font-family:'Ubuntu Mono';line-height:1.2;vertical-align:top;font-size:10.4pt!important"><div style="white-space:pre-wrap;color:blue">> </div><div style="white-space:pre-wrap;color:blue"># deu certo!!</div><div style="white-space:pre-wrap;color:blue"><br></div><div style="white-space:pre-wrap">O que pode estar ocorrendo? Não basta o meu vetor original ser do tipo character?</div><div style="white-space:pre-wrap;color:blue"><br></div><div style="white-space:pre-wrap;color:blue"><br></div></td></tr></tbody></table></td></tr></tbody></table></span></div></div><div><div><div><div dir="ltr"><div><div>Abraços,<br></div><div>Paulo<br></div></div></div></div></div>
</div></div>
<br>_______________________________________________<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/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.<br></blockquote></div><br></div></div>