title: dplyr case when between
body: <p>I would like to join two data sets and in first data set if the date is between StartDate and EndDate, 1 as added as coulmn names pros_sales. Below is my datasets</p>
  
  <pre><code>data1=data.frame(Date=as.Date("2015-06-28"),Storecode=34)
  data2=data.frame(Promo=c("Promo1","Promo2","Promo3","Promo4")
  ,StartDate=c("2015-02-10","2015-03-15"," 2015-05-24","2015-06-21")
  ,EndDate=c("2015-02-17","2015-03-22","2015-06-01","2015-06-28"))
  data1$Date &lt;- as.Date(data1$Date) 
  data2$StartDate &lt;- as.Date(data2$StartDate) 
  data2$EndDate &lt;- as.Date(data2$EndDate) 
  </code></pre>
  
  <p>My desired dataset below;</p>
  
  <pre><code> Date Storecode  Promo  StartDate    EndDate         pro_sales
  2015-06-28        34 Promo1 2015-02-10 2015-02-17         0
  2015-06-28        34 Promo2 2015-03-15 2015-03-22         0
  2015-06-28        34 Promo3 2015-05-24 2015-06-01         0
  2015-06-28        34 Promo4 2015-06-21 2015-06-28         1
  </code></pre>
  
  <p>Below is my code but it added 1 to all pro_sales.</p>
  
  <pre><code> data.frame( data1 %&gt;%
           mutate(dummy=TRUE) %&gt;%
           left_join(data2 %&gt;% mutate(dummy=TRUE)) %&gt;% 
           mutate(pro_sales = case_when(
             Date&gt;=StartDate | Date&lt;=EndDate ~ 1,
             FALSE ~ 0)))
  </code></pre>
  
  <p>Can you help me please? Thank you.</p>