title: Is value within a range
body: <p>I have two dataframes that I would like to compare.</p>
  
  <pre><code>instances &lt;- data.frame(id = c("AED","AED","CFR","DRR","DRR","DRR","UN","PO"),
           dates = as.POSIXct(c("2018-05-17 09:52:00","2018-05-17 10:49:00","2018-05-17 10:38:00","2018-05-17 11:29:00","2018-05-17 12:12:00","2018-05-17 13:20:00","2018-05-17 14:28:00","2018-05-17 15:59:00")))
  
  ranges &lt;- data.frame(id = c("AED","CFR","DRR","DRR","UN"),
               start = as.POSIXct(c("2018-05-17 10:00:00","2018-05-17 10:18:00","2018-05-17 11:18:00","2018-05-17 13:10:00","2018-05-17 14:18:00")),
               end = as.POSIXct(c("2018-05-17 11:56:00","2018-05-17 12:23:00","2018-05-17 12:01:00","2018-05-17 14:18:00",NA)))
  </code></pre>
  
  <p>By id, I want to compare each date in the instances dataframe against its respective date ranges listed in the ranges dataframe. If there is no matching id in the ranges dataframe then it should return as FALSE, and if ranges$end is NA it should also return FALSE. The result should be as follows:</p>
  
  <pre><code>result &lt;- data.frame(id = c("AED","AED","CFR","DRR","DRR","DRR","UN","PO"),
               dates = c("2018-05-17 09:52:00","2018-05-17 10:49:00","2018-05-17 10:38:00","2018-05-17 11:29:00","2018-05-17 12:12:00","2018-05-17 13:20:00","2018-05-17 14:28:00","2018-05-17 15:59:00"),
               inRange = c(FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE),
               outsideRange = c(TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE))
  </code></pre>