title: How to multiply every row of a data.table with a vector
body: <p>I have a data table <code>dt</code>, for example:</p>
  
  <pre><code>     a  b  c
  [1]  1  2  3
  [2]  2  3  4
  [3]  3  4  5
  [4]  4  5  6
  </code></pre>
  
  <p>I want to multiply the values from every <strong>row</strong> of my <code>dt</code> with the values from the vector <code>vec</code>:</p>
  
  <pre><code>vec
  
  1  0  0
  </code></pre>
  
  <p>I expect the following result for the output <code>dt</code>:</p>
  
  <pre><code>     a  b  c
  [1]  1  0  0
  [2]  2  0  0
  [3]  3  0  0
  [4]  4  0  0
  </code></pre>
  
  <p>I have solved this problem in a <code>for</code> loop. Is there any better (vectorized) and faster way to solve this problem? I sometimes have data tables with thousands of columns that is why the loop gets very slow. I would also like to possibly keep data table format and avoid converting. However, in the end, the solution with the fastest runtime is important for me.</p>