Multiply columns in a data frame by a vector
<p>What I want to do is multiply all the values in column 1 of a data.frame by the first element in a vector, then multiply all the values in column 2 by the 2nd element in the vector, etc...</p>

<pre><code>c1 &lt;- c(1,2,3)
c2 &lt;- c(4,5,6)
c3 &lt;- c(7,8,9)
d1 &lt;- data.frame(c1,c2,c3)

  c1 c2 c3
1  1  4  7
2  2  5  8
3  3  6  9

v1 &lt;- c(1,2,3)
</code></pre>

<p>So the result is this:</p>

<pre><code>  c1  c2  c3
1  1  8   21
2  2  10  24
3  3  12  27
</code></pre>

<p>I can do this one column at a time but what if I have 100 columns? I want to be able to do this programmatically. </p>