how to efficiently match two data tables in R
<p><strong>Situation:</strong>
I have a CSV file <code>A</code> with two columns <code>Customer ID</code> and <code>Entry date</code>.
<code>A</code> contains about 1.500.000 observations.</p>

<p>I have another CSV file <code>B</code> with a single column <code>Customer ID</code>.
<code>B</code> is a smaller subset of <code>A</code>.</p>

<p><strong>Goal:</strong>
Since the info about their entry date is missing in table <code>B</code>, I would like to get that info from table <code>A</code> and write it all into a new table <code>C</code>.</p>

<p><strong>Current Progress:</strong>
I've created 10 subsets S1,...,S10 from <code>A</code> and from each subset the maximum customer ID. In a <code>for</code> loop, I run through all entries of <code>B</code> and check if <code>B</code> lies within one of the subsets (via <code>customer ID</code> and <code>max c ID</code> of the subset). Once I've found a subset in which I am supposed to find the customer ID, I use the function <em><code>which</code></em> to look for the element of B in A.</p>

<p>This is awfully slow.</p>

<p>Isn't there another quicker way?</p>

<p>And which would be the best objects in R to use the CSV file as, currently, <code>A</code> is a <em>data Frame</em>, and <code>B</code> is a <em>large integer</em>.</p>