title: Transform table into dataframe R
body: <p>Say we have the following data:</p>
  <pre><code>user &lt;- c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3)
  type &lt;- c('new', 'recent', 'recent', 'old', 'recent', 'new', 'new', 'old', 'new', 'new', 'new', 'recent')
  df &lt;- data.frame(user, type)
  </code></pre>
  <p>If we compute the table, we get the following:</p>
  <pre><code>table(df$type) 
  &gt;   new    old recent 
       6      2      4 
  </code></pre>
  <p>I am looking for a function that takes in this table data and transforms it into a dataframe, regardless of the number of columns.
  Ideally, the dataframe would look like this:</p>
  <pre><code>type     count 
  new        6
  old        2
  recent     4
  </code></pre>