<div dir="ltr">Assim funciona para colocar o zero:<br><br>data <- ifelse(nchar(data) == 7, paste("0",data, sep=""), data)<br>as.Date(as.character(data), '%d%m%Y')<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-12 15:12 GMT-02:00 Leonard de Assis <span dir="ltr"><<a href="mailto:assis.leonard@gmail.com" target="_blank">assis.leonard@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="PT-BR"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Acho que tem que converter isso pra string e preencher o início com ZERO, caso o dia seja entre 1 e 9.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Depois é só usar as.date(sua var string, '%d/%m/%Y')<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Não lembro como colocar ZERO antes <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">De:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> R-br [mailto:<a href="mailto:r-br-bounces@listas.c3sl.ufpr.br" target="_blank">r-br-bounces@listas.c3sl.ufpr.br</a>] <b>Em nome de </b>Wagner Tassinari<br><b>Enviada em:</b> terça-feira, 12 de janeiro de 2016 12:00<br><b>Para:</b> <a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a><br><b>Assunto:</b> [R-br] Formatando datas<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal" style="margin-bottom:12.0pt">Olá pessoal,<u></u><u></u></p></div><p class="MsoNormal">Estou com um probleminha. Em meu banco de dados, minha variável data se encontra desta forma:<br><br><br><span style="font-size:10.0pt;font-family:"Lucida Console";color:black;background:#e1e2e5"><u></u><u></u></span></p><pre><span style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> data<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:black;background:#e1e2e5"> [1]  4042009  4042009 27072009 27072009 27072009  6082010  6082010  6082010<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:black;background:#e1e2e5"> [9]  6082010  6082010<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> library(chron)<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> data2 = chron(dates=data, format=c('dd/mm/yy'))<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> data2<u></u><u></u></span></pre><pre><span style="font-family:"Lucida Console";color:black;background:#e1e2e5"> [1] 24/Aug/13036 24/Aug/13036 23/Aug/76090 23/Aug/76090 23/Aug/76090 24/Dec/18621<u></u><u></u></span></pre><pre style="margin-bottom:12.0pt"><span style="font-family:"Lucida Console";color:black;background:#e1e2e5"> [7] 24/Dec/18621 24/Dec/18621 24/Dec/18621 24/Dec/18621<u></u><u></u></span></pre><pre style="line-height:11.25pt;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-width:initial;border-color:initial;white-space:pre-wrap!important"><span style="font-family:"Lucida Console";color:black;background:#e1e2e5">O certo seria: <br><br><br><u></u><u></u></span></pre><pre style="margin-bottom:12.0pt"><span style="font-family:"Lucida Console";color:black;background:#e1e2e5">[1] 04/04/2009 04/04/2009 27/07/2009 27/07/2009 06/08/2010 ...<u></u><u></u></span></pre><pre style="margin-bottom:12.0pt;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-width:initial;border-color:initial;white-space:pre-wrap!important"><span style="font-family:"Lucida Console";color:black;background:#e1e2e5">Alguém poderia me dar uma dica ?<u></u><u></u></span></pre><pre style="font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-width:initial;border-color:initial;white-space:pre-wrap!important"><span style="font-family:"Lucida Console";color:black;background:#e1e2e5">Obrigado<u></u><u></u></span></pre><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">Wagner S. Tassinari<br>Departamento de Matemática<br>Universidade Federal Rural do Rio de Janeiro.<br>BR-465, Km 7 - Seropedica, RJ - Brasil<br>CEP: 23890-000 <br>Skype: wagner.tassinari<br><a href="mailto:wtassinari@gmail.com" target="_blank">wtassinari@gmail.com</a><br><a href="mailto:tassinari@ufrrj.br" target="_blank">tassinari@ufrrj.br</a><br>-------------------------------------------------------<br>"Statistical thinking will one day be as necessary for efficient citizenship as the ability to read and write."  (H.G.Wellis)<u></u><u></u></p></div></div></div><div><table style="border:none;border-top:solid #aaabb6 1.0pt" border="1" cellpadding="0"><tbody><tr><td style="width:78.75pt;border:none;padding:11.25pt .75pt .75pt .75pt" width="105"><p class="MsoNormal" style="margin-top:22.5pt"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><span style="text-decoration:none"><img src="https://ipmcdn.avast.com/images/logo-avast-v1.png" border="0"></span></a><u></u><u></u></p></td><td style="width:352.5pt;border:none;padding:15.0pt .75pt .75pt .75pt" width="470"><p class="MsoNormal" style="margin-top:22.5pt;line-height:13.5pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#41424e">Este e-mail foi enviado por um computador sem vírus e protegido pelo Avast. <br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><span style="color:#4453ea">www.avast.com</span></a> <u></u><u></u></span></p></td></tr></tbody></table><p class="MsoNormal"><u></u> <u></u></p></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><br clear="all"><br>-- <br><div class="gmail_signature">Manoel Galdino<br><a href="https://sites.google.com/site/galdinomcz/" target="_blank">https://sites.google.com/site/galdinomcz/</a><br></div>
</div>