title: find if there is any overlap in R
body: <p>I am trying to write function which compare the ranges in two data frames and find overlaps.<br>
  my data frames have three columns <code>V1,V2,V3</code> (the first one is chromosome number, the second is start coordinate, the third is end of coordinate).<br>
  lets say: <code>df1</code></p>
  
  <pre><code> V1    V2  V3
  chr1   10  25
  chr1   20  100
  chr1   98  101
  chr2   10  15
  chr2   35  46
  chr3   50  55
  chr3   60  90
  chr4   5   100
  
  df2:
   V1   V2  V3
  chr1  95  105
  chr1  200 205
  chr2  45  50
  chr2  49  51
  chr2  55  90
  chr3  50  100
  chr4  101 110 
  </code></pre>
  
  <p>I wanna write function to find any overlap.  </p>
  
  <p>the function <code>find_overlap(df1,df2)</code> should return df1 with new column of overlap with df2 like:</p>
  
  <pre><code>df1:
   V1    V2  V3  overlap 
  chr1   10  25    0
  chr1   20  100   1
  chr1   98  101   1
  chr2   10  15    0
  chr2   35  46    1
  chr3   50  55    1
  chr3   60  90    1
  chr4   5   100   0
  </code></pre>
  
  <p>if i call <code>find_overlap(df2,df1)</code></p>
  
  <pre><code>df2:
   V1   V2  V3   overlap
  chr1  95  105   1
  chr1  200 205   0
  chr2  45  50    1
  chr2  49  51    0
  chr2  55  90    0
  chr3  50  100   1
  chr4  101 110   0
  </code></pre>
  
  <p>I would thankful if you tell me how can I do it in R?</p>
  
  <p>(It would be better if the function returns vector of overlaps instead of adding new column)<br>
  Thanks.</p>