If you know that your first date is a Friday then you can use seq with by="7 day", then you don't need to post filter the vector.
On Thu, Mar 1, 2012 at 1:40 PM, Ben quant <ccqu...@gmail.com> wrote: > Great thanks! > > ben > > On Thu, Mar 1, 2012 at 1:30 PM, Marc Schwartz <marc_schwa...@me.com> wrote: > >> On Mar 1, 2012, at 2:02 PM, Ben quant wrote: >> >> > Hello, >> > >> > How do I get the dates of all Fridays between two dates? >> > >> > thanks, >> > >> > Ben >> >> >> Days <- seq(from = as.Date("2012-03-01"), >> to = as.Date("2012-07-31"), >> by = "day") >> >> > str(Days) >> Date[1:153], format: "2012-03-01" "2012-03-02" "2012-03-03" "2012-03-04" >> ... >> >> # See ?weekdays >> >> > Days[weekdays(Days) == "Friday"] >> [1] "2012-03-02" "2012-03-09" "2012-03-16" "2012-03-23" "2012-03-30" >> [6] "2012-04-06" "2012-04-13" "2012-04-20" "2012-04-27" "2012-05-04" >> [11] "2012-05-11" "2012-05-18" "2012-05-25" "2012-06-01" "2012-06-08" >> [16] "2012-06-15" "2012-06-22" "2012-06-29" "2012-07-06" "2012-07-13" >> [21] "2012-07-20" "2012-07-27" >> >> HTH, >> >> Marc Schwartz >> >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.