title: get quartile for every row in matrix R
body: <p>I have a 46175*741 matrix. I want to get quartiles for every row. Based on this question (<a href="https://stackoverflow.com/questions/7508229/how-to-create-a-column-with-a-quartile-rank">How to create a column with a quartile rank?</a>), 
  I tried : </p>
  
  <pre><code>dat_quartiles &lt;- apply(t(dat) , 1, function(x) within(x, as.integer(cut(x, quantile(x, probs=0:4/4), include.lowest=TRUE))))
  </code></pre>
  
  <p>But I get the error: </p>
  
  <pre><code>Error in UseMethod("within") : no applicable method for 'within' applied to an object of class "c('integer', 'numeric')"
  </code></pre>
  
  <p>Where exactly am I going wrong?</p>