Re: [R] generate irregular series of dates

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Tue, 29 Jun 2010 13:09:31 -0600

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
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________ 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:13:12 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 Tue 29 Jun 2010 - 19:20:42 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