title: How to intersect two columns in r?
body: <p>I have a data frame as following and I want to intersect them to become one column.</p>
  
  <pre><code>ID&lt;-c('&gt;1','&gt;2','&gt;3','&gt;4','&gt;5')
  TYPE&lt;-c('A','B','O','A','B')
  old&lt;-data.frame(ID,TYPE)
  old
  
    ID TYPE
    &gt;1    A
    &gt;2    B
    &gt;3    O
    &gt;4    A
    &gt;5    B
  </code></pre>
  
  <p>I want to merge them and become a new data set to look like this.</p>
  
  <pre><code>  NEW_VAR 
    &gt;1  
     A  
    &gt;2    
     B
    &gt;3    
     O
    &gt;4    
     A
    &gt;5    
     B
  </code></pre>
  
  <p>I try the following code, but it does not work.</p>
  
  <pre><code>intersect(old$ID, old$TYPE)
  </code></pre>
  
  <p>But it shows </p>
  
  <pre><code>character(0)
  </code></pre>
  
  <p>Thanks in advance.</p>