title: Fastest way to sort each row of a large matrix in R
body: <p>I have a large matrix:</p>
  
  <pre><code>set.seed(1)
  a &lt;- matrix(runif(9e+07),ncol=300)
  </code></pre>
  
  <p>I want to sort each row in the matrix:</p>
  
  <pre><code>&gt; system.time(sorted &lt;- t(apply(a,1,sort)))
     user  system elapsed 
    42.48    3.40   45.88 
  </code></pre>
  
  <p>I have a lot of RAM to work with, but I would like a faster way to perform this operation.</p>