title: R: Create a New Column in R to determine Semester Based on Two Dates
body: <p>I have some data. ID and date and I'm trying to create a new field for semester.</p>
  
  <p>df:</p>
  
  <pre><code>id  date
  1   20160822
  2   20170109
  3   20170828
  4   20170925
  5   20180108
  6   20180402
  7   20160711
  8   20150831
  9   20160111
  10  20160502
  11  20160829
  12  20170109
  13  20170501
  </code></pre>
  
  <p>I also have a <code>semester</code> table:</p>
  
  <pre><code>start       end         season_year
  20120801    20121222    Fall-2012
  20121223    20130123    Winter-2013
  20130124    20130523    Spring-2013
  20130524    20130805    Summer-2013
  20130806    20131228    Fall-2013
  20131229    20140122    Winter-2014
  20140123    20140522    Spring-2014
  20140523    20140804    Summer-2014
  20140805    20141227    Fall-2014
  20141228    20150128    Winter-2015
  20150129    20150528    Spring-2015
  20150529    20150803    Summer-2015
  20150804    20151226    Fall-2015
  20151227    20160127    Winter-2016
  20160128    20160526    Spring-2016
  20160527    20160801    Summer-2016
  20160802    20161224    Fall-2016
  20161225    20170125    Winter-2017
  20170126    20170525    Spring-2017
  20170526    20170807    Summer-2017
  20170808    20171230    Fall-2017
  20171231    20180124    Winter-2018
  20180125    20180524    Spring-2018
  20180525    20180806    Summer-2018
  20180807    20181222    Fall-2018
  20181223    20190123    Winter-2019
  20190124    20190523    Spring-2019
  20190524    20180804    Summer-2019
  </code></pre>
  
  <p><strong>I'd like to create a new field in <code>df</code> if <code>df$date</code> is between <code>semester$start</code> and <code>semester$end</code>, then place the respective value <code>semester$season_year</code> in <code>df</code></strong></p>
  
  <p>I tried to see if the lubridate package could help but that seems to be more for calculations</p>
  
  <p>I saw <a href="https://stackoverflow.com/questions/48000987/how-can-i-create-dates-in-year-semester-format-in-r">this question</a> and it seems to be the closest to what i want, but, to make things more complicated, not all of our semesters are six months </p>