Re: [R] generate irregular series of dates

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 29 Jun 2010 15:21:48 -0400

On Tue, Jun 29, 2010 at 6:22 AM, Simon Kiss <sjkiss_at_gmail.com> wrote:
> Dear colleagues, particularly academic ones,
> So I'm creating a Microsoft Word template for myself so that every time I
> teach a new course, I don't have to enter in the dates manually for each
> class session.
> I'd like to use an R script that can generate an irregular series of dates
> starting from one date (semester begin) to another (semester end) using an
> irregular interval in between (Tuesdays and Thursdays, for example).
> I know that a regular series of dates is no problem, but what about an
> irregular series?

Generate all the dates in the range of interest and then pick off the Tuesdays and Thursdays:

dd <- seq(as.Date("2010-01-01"), as.Date("2010-12-31"), "day") dd[weekdays(dd) %in% c("Tuesday", "Thursday")]



R-help_at_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. Received on Tue 29 Jun 2010 - 19:29:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 01 Jul 2010 - 15:40:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive