title: Recurrent Variable in R
body: <p>I'm working on a database which has information about individual identification (<code>Id</code>), <code>Date</code>, <code>Group_id</code></p>
  <pre><code>data = data.frame(Id = 1:6, 
                    Date = as.Date(c(&quot;2010-12-28&quot;, &quot;2011-01-28&quot;, &quot;2011-01-30&quot;, &quot;2009-09-01&quot;, &quot;2009-09-05&quot;, &quot;2012-12-20&quot;)), 
                    Group_id = c(1,1,2,3,3,3))
  </code></pre>
  <p>and now I would like to create a new dummy <code>Recurrent</code> variable that returns 1 if there are previous information about another individual from the same <code>Group_id</code> and 0 otherwise . My desired output is like this:</p>
  <pre><code>Id      Date      Group_id  Recurrent
  1      2010-12-28    1          0
  2      2011-01-28    1          1
  3      2011-01-30    2          0
  4      2009-09-01    3          0
  5      2009-09-05    3          1
  6      2012-12-20    3          1
  </code></pre>
  <p>but I'm quite confused about how to perform that. Can anyone give me a tip on how to do that?</p>
  <p>regards!</p>