title: How to create a sequence of week intervals showing the monday and sunday in r?
body: <p>I am trying to get a sequence week interval from 2018-09-03 to 2021-03-23 showing only Monday and Sunday. I would get as result dates_ranges.</p>
  <p>dates_ranges=c(&quot;2018-09-03 2018-09-09&quot;, &quot;2018-09-10 2018-09-16&quot;, &quot;2018-09-17 2018-09-23&quot;, ... , &quot;2021-03-22 2021-03-28&quot;</p>
  <p>By using the seq. function I get only the Mondays. A second approach I used was
  Map(c, dates_ranges[-length(dates_ranges)], dates_ranges[-1]) but Than I have seqence of intervals as a  numeric
  Could u please help me?</p>
  <p>`</p>
  <pre><code> startdate &lt;- as.Date(&quot;2018-09-03&quot;)
    enddate &lt;- as.Date(&quot;2021-03-22&quot;)
  
   #first approach
   dates_ranges&lt;- seq.Date(from= (startdate),to=enddate, by= 
   &quot;week&quot;)
  
    #second approach 
    dates_ranges&lt;- as.numeric(dates_ranges)
    weeklyinterval&lt;-Map(c, dates_ranges[-length(dates_ranges)], 
    dates_ranges[-1])
  </code></pre>
  <p>`</p>