<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:windowtext;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:10.0pt;
font-family:"Arial",sans-serif;
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"Pr\00E9-formata\00E7\00E3o HTML Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.Pr-formataoHTMLChar
{mso-style-name:"Pr\00E9-formata\00E7\00E3o HTML Char";
mso-style-priority:99;
mso-style-link:"Pr\00E9-formata\00E7\00E3o HTML";
font-family:"Courier New";
color:black;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=PT-BR link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Prezado,</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Quando executo o script para calcular o período retorna erro por conta dos NA’S.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Obrigado pela ajuda.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Enviado do meu telefone Windows 10</p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>De: </b><a href="mailto:r-br@listas.c3sl.ufpr.br">salah via R-br</a><br><b>Enviado:</b>quinta-feira, 16 de junho de 2016 23:23<br><b>Para: </b><a href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a><br><b>Assunto: </b>Re: [R-br] Operação entre datas</p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>segue sugestão<br><br>library(eeptools)<br><br>DADOS = data.frame(<br> NASCIMENTO = c("26/11/97", "20/03/99", "14/05/99","06/05/98", "03/01/00", "19/05/97", "01/02/01", "28/11/97", "10/02/00"), <br> DATA_FATO = c("23/02/15", "28/03/15", "08/04/15", "08/04/15", "08/04/15", "08/05/15", "17/05/15", "03/06/15", "03/06/15"))<br><br>## converter para Date<br>DADOS$NASCIMENTO = as.Date(DADOS$NASCIMENTO, "%d/%m/%y")<br>DADOS$DATA_FATO = as.Date(DADOS$DATA_FATO, "%d/%m/%y")<br><br>## calcula o intervalo em anos<br>DADOS$IDADE = floor(age_calc(DADOS$NASCIMENTO, DADOS$DATA_FATO, units = "years"))<br><br>DADOS<br><br>saudações</span><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>Em 16/06/2016 14:45, Amikobh via R-br escreveu:<o:p></o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p><span style='font-size:13.5pt'>Prezados,</span><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p></o:p></span></p><p><span style='font-size:13.5pt'>Desde já, obrigado pela ajuda.</span></p><p><span style='font-size:13.5pt'>Tendo duas variáveis com datas referentes a determinada pessoa:</span><o:p></o:p></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'>NASCIMENTO<span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>DATA_FATO<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>26/11/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>23/02/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>20/03/99<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>28/03/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>14/05/99<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>06/05/98<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/01/00<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>19/05/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/05/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>01/02/01<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>17/05/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>28/11/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/06/15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>10/02/00<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/06/15<o:p></o:p></span></p></td></tr></table><p><span style='font-size:13.5pt'>Como procedo para criar mais uma coluna que calcula a idade no dia da ocorrência de determinado fato? De tal forma que obtenha:</span><o:p></o:p></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'>NASCIMENTO<span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>DATA_FATO<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>IDADE<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>26/11/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>23/02/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>17<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>20/03/99<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>28/03/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>16<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>14/05/99<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>06/05/98<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>16<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/01/00<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/04/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>15<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>19/05/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>08/05/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>17<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>01/02/01<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>17/05/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>14<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>28/11/97<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/06/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>17<o:p></o:p></span></p></td></tr><tr style='height:7.3pt'><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>10/02/00<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>03/06/15<o:p></o:p></span></p></td><td style='border:solid black 1.0pt;padding:.75pt .75pt .75pt .75pt;height:7.3pt'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>15<o:p></o:p></span></p></td></tr></table><p><o:p> </o:p></p><p><span style='font-size:13.5pt'>Valeu, gente!</span></p><p><o:p> </o:p></p><p><o:p> </o:p></p><p><o:p> </o:p></p><p><o:p> </o:p></p><p><o:p> </o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><br><br><br><o:p></o:p></span></p><pre>_______________________________________________</pre><pre>R-br mailing list</pre><pre><a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a></pre><pre><a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a></pre><pre>Leia o guia de postagem (<a 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.</pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></body></html>