title: How to divide each row of a matrix by elements of a vector in R
body: <p>I would like to divide each <strong>row</strong> of a matrix by a fixed vector. For example </p>
  
  <pre><code>mat&lt;-matrix(1,ncol=2,nrow=2,TRUE)
  dev&lt;-c(5,10)
  </code></pre>
  
  <p>Giving <code>mat/dev</code> divides each <strong>column</strong> by <code>dev</code>. </p>
  
  <pre><code>     [,1] [,2]
  [1,]  0.2  0.2
  [2,]  0.1  0.1
  </code></pre>
  
  <p>However, I would like to have this as a result, i.e. do the operation <strong>row-wise</strong> :</p>
  
  <pre><code>rbind(mat[1,]/dev, mat[2,]/dev)
  
       [,1] [,2]
  [1,]  0.2  0.1
  [2,]  0.2  0.1
  </code></pre>
  
  <p>Is there an explicit command to get there?</p>