title: Comparing one value across multiple rows in one data frame with values across multiple rows in a second data frame
body: <p>Scenario:</p>
  
  <p>2-column dataframe_1 (300,000 rows)</p>
  
  <p>head(dataframe_1):</p>
  
  <p>CHR POS</p>
  
  <p>1 2000</p>
  
  <p>1   3000    </p>
  
  <p>2       1500</p>
  
  <p>3       3000    </p>
  
  <p>3-column dataframe_2 (300 rows)</p>
  
  <p>head(dataframe_2):</p>
  
  <p>CHR     POS_START   POS_END</p>
  
  <p>1       1500        2500</p>
  
  <p>1       3200        4000</p>
  
  <p>2       1200            1600</p>
  
  <p>2       2000        2200</p>
  
  <p>3       5000        5500</p>
  
  <p>4       1000        1200</p>
  
  <p>The goal is to take dataframe_1 and compare the POS column of each row against dataframe_2 (columns POS_START and POS_END) and return a vector (length = nrow(dataframe_1)) that indicates which row of dataframe_1 lists a POS value that is within the range as indicated in dataframe_2.
  Note that each POS value is linked to a particular CHR value.</p>
  
  <p>Example return vector:</p>
  
  <p>CHR     POS     EXAMPLE_RETURN_VECTOR</p>
  
  <p>1       2000    TRUE</p>
  
  <p>1       3000    FALSE</p>
  
  <p>2       1500    TRUE</p>
  
  <p>3       3000    FALSE</p>
  
  <p>What’s the best strategy here?</p>
  
  <p>Thanks!</p>