title: How can I count the number of entries of a column based on the distinct entries of another column
body: <p>My data in a file is like below with multiple columns:</p>
  
  <pre><code>A                B             
  
  Tiger         Animal         
  Parrot        Bird
  Lion          Animal
  Elephant      Animal
  Crow          Bird
  Horse         Animal
  Man           Human
  Dog           Animal
  </code></pre>
  
  <p>I want to find the number of entries in column A corresponding to distinct entries in column B. If possible in R or may be a perl script for this.</p>
  
  <p>Output as:</p>
  
  <pre><code>Animal 5
  Bird   2
  Human  1
  </code></pre>
  
  <p>Moreover, if possible to find out if the entries in column A has been repeated for the distinct entries in column B like<br/></p>
  
  <pre><code>A              B   
  Tiger         Animal         
  Tiger         Animal
  </code></pre>