multiply two different data.frames to a new data.frame with new columnheaders from input column
<p>I would like to multiply several columns from a certain data.frame <strong>* df1*</strong> with the <strong>Percentages</strong> matching the headers of the columns in  <strong>* df1*</strong>. These are given in data.frame <strong><em>df2</em></strong>, column 1, called <strong>ID</strong>. I would like the output to be as in <strong>df3</strong>. </p>

<p>Note that my dataset is large. There are 13.000 rows and 33 columns in <strong>df1</strong>. There are 136 rows and 3 columns in <strong>df2</strong>.</p>

<p>What is the best way to handle this?</p>

<p>Examples of <strong>df1, df2, df3</strong> are given below.</p>

<p><strong><em>df1</em></strong>:
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Date                  V1               V2            V3            V4
1/1/2000               0               0.4           0             0
2/1/2000               0               0.1           0             0.1
3/1/2000               0.5             0             0             1
4/2000                 0.8             1.5           1             1</code></pre>
</div>
</div>
</p>

<p><strong><em>df2</em></strong>:
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>    ID                Subbasin       Percentage
V1                 001               0.4
V4                 001               0.6
V1                 002               0.2
V2                 002               0.8
V1                 003               0.1
V2                 003               0.3
V3                 003               0.2
V4                 003               0.4</code></pre>
</div>
</div>
</p>

<p><strong><em>df3</em></strong>:
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Date                   001             002             003
1/1/2000               0               0.32            0.12
2/1/2000               0.06            0.08            0.07
3/1/2000               0.8             0.1             0.45
4/2000                 0.92            1.36            1.13</code></pre>
</div>
</div>
</p>

<p>I guess I have to start with omitting the <strong>Date</strong>, with </p>

<pre><code>df1 &lt;- NULL
</code></pre>