<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Arial">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</font><br>
<br>
<div class="moz-cite-prefix">Em 16/06/2016 14:45, Amikobh via R-br
escreveu:<br>
</div>
<blockquote
cite="mid:ceddbc10-c43e-e15f-115a-3eb6602e2eaf@gmail.com"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<p><font size="+1">Prezados,</font></p>
<p><font size="+1">Desde já, obrigado pela ajuda.</font></p>
<p><font size="+1">Tendo duas variáveis com datas referentes a
determinada pessoa:</font></p>
<p>
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
</p>
<p>
<title></title>
<meta name="generator" content="LibreOffice 5.1.3.2 (Linux)">
<style type="text/css">
body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Arial"; font-size:x-small }
a.comment-indicator:hover + comment { background:#ffd; position:absolute; display:block; border:1px solid black; padding:0.5em; }
a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em; }
comment { display:none; }
</style>
<table cellspacing="0" border="0">
<colgroup width="151"></colgroup> <colgroup width="161"></colgroup>
<tbody>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" align="center"
height="17">NASCIMENTO<br>
</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" align="center">DATA_FATO<br>
</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">26/11/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">23/02/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">20/03/99</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">28/03/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">14/05/99</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">06/05/98</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">03/01/00</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">19/05/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/05/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">01/02/01</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">17/05/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">28/11/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">03/06/15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">10/02/00</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">03/06/15</td>
</tr>
</tbody>
</table>
</p>
<p><font size="+1">Como procedo para criar mais uma coluna que
calcula a idade no dia da ocorrência de determinado fato? De
tal forma que obtenha:</font></p>
<p>
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
</p>
<p>
<title></title>
<meta name="generator" content="LibreOffice 5.1.3.2 (Linux)">
<style type="text/css">
body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Arial"; font-size:x-small }
a.comment-indicator:hover + comment { background:#ffd; position:absolute; display:block; border:1px solid black; padding:0.5em; }
a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em; }
comment { display:none; }
</style>
<table cellspacing="0" border="0">
<colgroup width="151"></colgroup> <colgroup width="161"></colgroup>
<colgroup width="85"></colgroup> <tbody>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" align="center"
height="17">NASCIMENTO</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" align="center">DATA_FATO</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" align="center">IDADE</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">26/11/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">23/02/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="17"
sdnum="1046;" align="center">17</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">20/03/99</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">28/03/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="16"
sdnum="1046;" align="center">16</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">14/05/99</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="15"
sdnum="1046;" align="center">15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">06/05/98</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="16"
sdnum="1046;" align="center">16</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">03/01/00</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/04/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="15"
sdnum="1046;" align="center">15</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">19/05/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">08/05/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="17"
sdnum="1046;" align="center">17</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">01/02/01</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">17/05/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="14"
sdnum="1046;" align="center">14</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">28/11/97</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">03/06/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="17"
sdnum="1046;" align="center">17</td>
</tr>
<tr>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center" height="17">10/02/00</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdnum="1046;0;@"
align="center">03/06/15</td>
<td style="border-top: 1px solid #000000; border-bottom:
1px solid #000000; border-left: 1px solid #000000;
border-right: 1px solid #000000" sdval="15"
sdnum="1046;" align="center">15</td>
</tr>
</tbody>
</table>
</p>
<p><br>
</p>
<p><font size="+1">Valeu, gente!</font><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a class="moz-txt-link-freetext" 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>
<br>
</body>
</html>