title: R-Count and list the maximum count row by row
body: <p>I have a matrix:</p>
  
  <pre><code>count &lt;- matrix(c("a","a","a","b","b","i","i","b","a","a","g","i","a","g","g","g"),ncol=4,byrow=TRUE)
  
      [,1] [,2] [,3] [,4]
  [1,]  a    a    a   b
  [2,]  b    i    i   b
  [3,]  a    a    g   i
  [4,]  a    g    g   g
  </code></pre>
  
  <p>I wanted to find the value(s) which occurs the maximum number of times in each row and assign those values to another column, to look like this:</p>
  
  <pre><code>    [,1] [,2] [,3] [,4] [,count]
  [1,]  a    a    a   b      a
  [2,]  b    i    i   b      b &amp; i
  [3,]  a    h    h   i      h
  [4,]  a    g    g   g      g 
  </code></pre>
  
  <p>I tried using <code>apply(count,1,max)</code> but did not work out.</p>