title: What is the right way to multiply data frame by vector?
body: <p>I'm trying to multiply a data frame <code>df</code> by a vector <code>v</code>, so that the product is a data frame, where the <code>i</code>-th row is given by <code>df[i,]*v</code>. I can do this, for example, by</p>
  
  <pre><code>df &lt;- data.frame(A=1:5, B=2:6); v &lt;- c(0,2)
  as.data.frame(t(t(df) * v))
     A  B
  1  0  4
  2  0  6
  3  0  8
  4  0 10
  5  0 12
  </code></pre>
  
  <p>I am sure there has to be a more <em>R-style</em> approach (and a very simple one!), but nothing comes on my mind. I even tried something like</p>
  
  <pre><code>apply(df, MARGIN=1, function(x) x*v)
  </code></pre>
  
  <p>but still, non-readable constructions like <code>as.data.frame(t(.))</code> are required.<br>
  How can I find an efficient and elegant workaround here?</p>