R filtering table and inserting information : <p>I currently have following table structure</p>

<p><strong>Table1</strong></p>

<pre><code>id  a
11  4
11  3
22  1
22  3
22  5
33  2
33  1
44  6
44  8
66  5
66  7
77  6
</code></pre>

<p><strong>Table2</strong></p>

<pre><code>id  score 
11  12
33  22
44  20
</code></pre>

<p>I want to delete every row from Table1, that does not contain any of the id in Table2$id. <code>unique(Table2$id)</code> should generate such an unique id list. Further, I need to write the <em>score</em> from Table2 into each corresponding id of Table1. The desired dataframe would be:</p>

<p><strong>Result</strong></p>

<pre><code>id  a score 
11  4 12
11  3 12
33  2 22
33  1 22
44  6 20
44  8 20
</code></pre>
