# [R] generate irregular series of dates

Greg Snow Greg.Snow at imail.org
Tue Jun 29 21:09:31 CEST 2010

```A fairly simple way is to generate one series with all the Tuesdays, then another with all the Thursdays, combine and sort.

> sort( c( seq.Date( as.Date('2010-6-29'), by='week', length.out=10),
+ seq.Date( as.Date('2010-7-1'), by='week', length.out=10) )
+ )
[1] "2010-06-29" "2010-07-01" "2010-07-06" "2010-07-08" "2010-07-13"
[6] "2010-07-15" "2010-07-20" "2010-07-22" "2010-07-27" "2010-07-29"
[11] "2010-08-03" "2010-08-05" "2010-08-10" "2010-08-12" "2010-08-17"
[16] "2010-08-19" "2010-08-24" "2010-08-26" "2010-08-31" "2010-09-02"
>

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Simon Kiss
> Sent: Tuesday, June 29, 2010 4:22 AM
> To: r-help at r-project.org
> Subject: [R] generate irregular series of dates
>
> 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?
> Yours,
> Simon Kisss
> *********************************
> Simon J. Kiss, PhD
> SSHRC and DAAD Post-Doctoral Fellow
> John F. Kennedy Institute of North America Studies
> Free University of Berlin
> Lansstraße 7-9
> 14195 Berlin, Germany
> Cell: +49 (0)1525-300-2812,
> Web: http://www.jfki.fu-berlin.de/index.html
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help