Create indicator from two groups : <p>I have this data frame:</p>

<pre><code>df&lt;- data.frame(j = c("a", "a", "b", "b", "c", "c"), 
                t = c(2000,2010,2000,2010,2000,2010))
&gt; df
        j    t
1       a 2000
2       a 2010
3       b 2000
4       b 2010
5       c 2000
6       c 2010
</code></pre>

<p>I am trying to create an indicator <code>jt</code> to identify the country/year:</p>

<pre><code>        j    t  jt
1       a 2000  1
2       a 2010  2
3       b 2000  3
4       b 2010  4
5       c 2000  5
6       c 2010  6
7       c 2010  6
8       c 2010  6
</code></pre>

<p>The last two observations signal that I can have multiple occurrences.</p>
