title: How to calculate the mode of all rows or columns from a dataframe
body: <p>I would like how to calculate the mode of all rows or columns from a matrix.</p>
  
  <p>For example, I have:</p>
  
  <pre><code>seq &lt;- c(1,2,3)
  seq1 &lt;- rep(seq, each=4)
  mat1 &lt;- matrix(seq1, 3)
  mat1
  rows &lt;- c(1,2,3)
  columns &lt;- c("a", "b", "c", "d")
  colnames (mat1) &lt;- columns
  rownames (mat1) &lt;- rows
  mat1
    a b c d
  1 1 1 2 3
  2 1 2 2 3
  3 1 2 3 3
  </code></pre>
  
  <p>Now, I want to calculate the mode of each row and column. 
  Thanks in advance</p>