Adding value from one data.frame to another data.frame by matching a variable
<p>Suppose I have two data frames df1 and df2 as follows</p>

<pre><code>Df1

Id Price Profit Month
10  5     2      1
10  5     3      2
10  5     2      3
11  7     3      1
11  7     1      2
12  0     0      1
12  5     1      2

Df2

Id Name
9  Kane
10 Jack
10 Jack
11 Will
12 Matt
13 Lee
14 Han
</code></pre>

<p>Now I want to insert a new column in <code>Df1</code> named <code>Name</code> and get its value from <code>Df2</code> based on matching <code>Id</code></p>

<p>So modified Df1 will be </p>

<pre><code>Id Price Profit Month Name
10  5     2      1    Jack
10  5     3      2    Jack
10  5     2      3    Jack
11  7     3      1    Will
11  7     1      2    Will
12  0     0      1    Matt
12  5     1      2    Matt
</code></pre>