title: Comparing 2 datasets in R
body: <p>I have 2 extracted data sets from a dataset called babies2009( 3 vectors count, name, gender )</p>
  
  <p>One is girls2009 containing all the girls and the other boys2009.
  I want to find out what similar names exist between boys and girls.</p>
  
  <p>I tried this</p>
  
  <pre><code>common.names = (boys2009$name %in% girls2009$name)
  </code></pre>
  
  <p>When I try </p>
  
  <pre><code>babies2009[common.names, ] [1:10, ]
  </code></pre>
  
  <p>all I get is the girl names not the common names.</p>
  
  <p>I have confirmed that both data sets indeed contain boys and girls respectively by doing taking a 10 sample...</p>
  
  <pre><code>boys2009 [1:10,]
  girsl2009 [1:10,]
  </code></pre>
  
  <p>How else can I compare the 2 datasets and determine what values they both share.
  Thanks,</p>