title: Matching a date to date intervals in another data frame
body: <p>I'm summarising some data to plot in R. I'd like to show the data on a 7 day interval basis with the x-axis being the week-beginning.</p>
  
  <p>sample of the summary data:</p>
  
  <pre><code>structure(list(Date = structure(c(17843, 17843, 17844, 17846, 
                                17846, 17847, 17847, 17847, 17847, 17848, 17848, 17871, 17871, 
                                17871, 17871, 17872, 17872, 17873, 17873, 17873, 17873, 17873, 
                                17944, 17945, 17945, 17945, 17945, 17945, 17945, 17945, 17945, 
                                17945, 17945), class = "Date"), Source = df &lt;- structure(c(1L, 1L, 
                                                                                     2L, 1L, 4L, 1L, 3L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 
                                                                                     1L, 1L, 1L, 2L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("direct", 
                                                                                                                                                             "google organic", "other organic search", "PR_referral"), class = "factor"), 
             Revenue = c(1897, 999, 2077.23, 1023.73, 1048, 1897, 949, 
                         949, 999, 849.15, 2077.23, 799.2, 819.18, 865.13, 819.18, 
                         1517.6, 898.2, 2446, 239.2, 867.13, 1517.6, 869.13, 799.2, 
                         853.1, 799.2, 799.2, 799.2, 799.2, 799.2, 799.2, 799.2, 1652.3, 
                         1083.25)), row.names = c(NA, -33L), class = "data.frame")
  </code></pre>
  
  <p>Using <code>seq</code> and the <code>min</code> and <code>max</code> dates within <code>df$Date</code> I created a data frame of 7 day intervals:</p>
  
  <pre><code>date_interval &lt;- structure(list(week_beginning = structure(c(17827, 17834, 17841, 
                                                           17848, 17855, 17862, 17869, 17876, 17883, 17890, 17897, 17904, 
                                                           17911, 17918, 17925, 17932, 17939, 17946, 17953), class = "Date"), 
                              week_ending = structure(c(17833, 17840, 17847, 17854, 17861, 
                                                        17868, 17875, 17882, 17889, 17896, 17903, 17910, 17917, 17924, 
                                                        17931, 17938, 17945, 17952, NA), class = "Date")), class = c("tbl_df", 
                                                                                                                     "tbl", "data.frame"), row.names = c(NA, -19L))
  </code></pre>
  
  <p>What I'm trying to achieve is to add a column to <code>df</code> that is the week-beginning referenced from the <code>date_interval</code> data frame, for each observation of <code>df$Date</code>.</p>
  
  <p>I'm thinking this may involve using <code>which</code> but can't get that to work, a non working example being:</p>
  
  <pre><code>converters %&gt;%
    mutate(test = which(Date &gt;= date_interval$week_beginning &amp; Date &lt;= date_interval$week_ending))
  </code></pre>