title: R - create TRUE/FALSE column if dates are within a certain timeframe
body: <p>I am working with a dataframe in which two of my columns are dates. I'd like to add a new column, let's call it <code>RANGE</code>, that returns either <code>TRUE</code> or <code>FALSE</code> if the two column's dates are within +/- 15 days of each other.</p>
  <p>My reproducible input:</p>
  <pre><code>df &lt;- structure(list(i = 2:7, j = c(1L, 1L, 1L, 1L, 1L, 1L), distance = structure(c(5455.32297802238, 
  5424.40832625047, 4430.5045023107, 6247.9601523913, 4064.97434408376, 
  5910.5574526888), units = structure(list(numerator = &quot;m&quot;, denominator = character(0)), class = &quot;symbolic_units&quot;), class = &quot;units&quot;), 
      HD_YEAR.i = c(&quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;
      ), HD_YEAR.j = c(&quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, &quot;2019&quot;, 
      &quot;2019&quot;), TERRITORY.i = c(&quot;DISCGO&quot;, &quot;SCHOLA&quot;, &quot;COXFER&quot;, &quot;LOWESP&quot;, 
      &quot;SEACOA&quot;, &quot;HGTCCC&quot;), TERRITORY.j = c(&quot;RIVERF&quot;, &quot;RIVERF&quot;, 
      &quot;RIVERF&quot;, &quot;RIVERF&quot;, &quot;RIVERF&quot;, &quot;RIVERF&quot;), HATCH_DATE.i = structure(c(17989, 
      17992, 17982, 18010, 18005, 18017), class = &quot;Date&quot;), HATCH_DATE.j = structure(c(17981, 
      17981, 17981, 17981, 17981, 17981), class = &quot;Date&quot;)), row.names = 2:7, class = &quot;data.frame&quot;)
  </code></pre>
  <p>If done correctly, the new column should read:</p>
  <pre><code>|RANGE|
  |-----|
  |TRUE |
  |TRUE |
  |TRUE |
  |FALSE|
  |FALSE|
  |FALSE|
  </code></pre>
  <p>I realize this is a simple task, but I am still learning. Then I will go on to filter out the <code>FALSE</code> but that I can do.</p>