title: Divide each data frame row by vector in R
body: <p>I'm trying to divide each number within a data frame with 16 columns by a specific number for each column. The numbers are stored as a data frame with 1-16 corresponding to the samples in the larger data frames columns 1-16. There is a single number per column that I need to divide by each number in the larger spreadsheet and print the output to a final spreadsheet.</p>
  
  <p>Here's and example of what I'm starting with. The spreadsheet to be divided.</p>
  
  <pre><code>            X131.478.1 X131.478.2 X131.NSC.1 X131.NSC.2 X166.478.1 X166.478.2
  1/2-SBSRNA4          4          2          2          6          7          6
  A1BG                93         73         88         86         58         65
  A1BG-AS1           123        103         96        128         46         57
  </code></pre>
  
  <p>The numbers to divide the spreadsheet by</p>
  
  <pre><code>X131.478.1 1.0660880
  X131.478.2 0.9104053
  X131.NSC.1 0.8642545
  X131.NSC.2 0.9611866
  X166.478.1 0.9711406
  X166.478.2 1.0560121
  </code></pre>
  
  <p>And the expected results, not necessarily rounded as I did here.</p>
  
  <pre><code>    X131.478.1 X131.478.2 X131.NSC.1 X131.NSC.2 X166.478.1 X166.478.2
  1/2-SBSRNA4          3.75          2.19          2.31          6.24          7.20         5.68
  A1BG                87.23         80.17         101.82         89.47         59.72         61.55
  A1BG-AS1           115.37        113.13         111.07        133.16         47.36         53.97
  </code></pre>
  
  <p>I tried simply dividing the data frames mx2 = mx/sf with mx being the large data set and sf being the data frame of numbers to divide by. That seemed to divide everything by the first number in the sf data set.</p>
  
  <p>The numbers for division were generated by estimateSizeFactors, part of the DESeq package if that helps.</p>
  
  <p>Any help would be great. Thanks!</p>