Dear Gabor,
Yours worked really well. For what it's worth, here is the final
product.
I also added a line or two to reconvert the dates back to written form
(October 15 2010).
require(chron)
dd <- seq(as.Date("INSERT FIRST DATE OF CLASSES IN TERM HERE"),
as.Date("INSERT LAST DAY OF CLASSES IN TERM HERE"), "day")
a=as.character(dd[weekdays(dd) %in% c("INSERT FIRST WEEKDAY OF CLASS",
"INSERT SECOND WEEKDAY OF CLASS")])
a=chron(a, format = c(dates="y-m-d"), out.format=c(dates="month day,
year"))
write.table(a, "INSERT FILE LOCATION WHERE YOU WISH TO SAVE DATES",
quote=FALSE, col.names=FALSE, row.names=FALSE)
Thanks a lot.
Simon Kiss
On 29-Jun-10, at 9:21 PM, Gabor Grothendieck wrote:
On Tue, Jun 29, 2010 at 6:22 AM, Simon Kiss <sjk...@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")]
*********************************
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@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.