Counting duplicates in R
<p>I would like to know how it would be possible to make a new variable counting how many ID duplicates I have for certain years. For example, below I want to count for the year 2014 how many times before that year that ID was repeated. That way in the year 2015 it is counting the ID's in both 2013 and 2014.</p>

<pre><code>ID   Term   Year    Repeats
122   L      2013     N/A
112   L      2013     N/A   
002   L      2013     N/A   
152   L      2013     N/A
124   L      2013     N/A
122   L      2014     1
102   L      2014     N/A
142   L      2014     N/A
152   L      2014     N/A
120   L      2014     N/A
198   L      2014     N/A
122   L      2015     2
012   L      2015     N/A
101   L      2015     N/A
092   L      2015     N/A
031   L      2015     N/A
</code></pre>