title: count frequency of rows based on a column value in R
body: <p>I understand that this is quite a simple question, but I haven't been able to find an answer to this.</p>
  
  <p>I have a data frame which gives you the id of a person and his hobby. Since a person may have many hobbies, the id field may be repeated in multiple rows, each with a different hobby. I have been trying to print out only those rows which have more than one hobbies. I was able to get the frequencies using <strong>table</strong>. </p>
  
  <ol>
  <li><p>But how do I apply the condition to print only when the frequency is greater than one.</p></li>
  <li><p>Secondly, is there a better way to find frequencies without using table.</p></li>
  </ol>
  
  <p>This is my attempt with table without the filter for frequency greater than one</p>
  
  <pre><code>&gt; id=c(1,2,2,3,2,4,3,1)
  &gt; hobby = c('play','swim','play','movies','golf','basketball','playstation','gameboy')
  &gt; df = data.frame(id, hobby)
  &gt; table(df$id)
  
  1 2 3 4 
  2 3 2 1 
  </code></pre>