Re: [R] Getting a particular weekday for a given month

2014-04-07 Thread Enrico Schumann
On Mon, 07 Apr 2014, Christofer Bogaso writes: > Hi, > > Given a month name, I am looking for some script to figure out, what is the > date for 3rd Wednesday. For example let say I have following month: > > library(zoo) > Month <- as.yearmon(as.Date(Sys.time())) > > I need to answer: What is the

Re: [R] Getting a particular weekday for a given month

2014-04-07 Thread Gabor Grothendieck
On Mon, Apr 7, 2014 at 1:49 PM, Christofer Bogaso wrote: > Hi, > > Given a month name, I am looking for some script to figure out, what is the > date for 3rd Wednesday. For example let say I have following month: > > library(zoo) > Month <- as.yearmon(as.Date(Sys.time())) > > I need to answer: Wha

Re: [R] Getting a particular weekday for a given month

2014-04-07 Thread Ted Harding
On 07-Apr-2014 17:49:09 Christofer Bogaso wrote: > Hi, > Given a month name, I am looking for some script to figure out, > what is the date for 3rd Wednesday. For example let say I have > following month: > > library(zoo) > Month <- as.yearmon(as.Date(Sys.time())) > > I need to answer: What is th

Re: [R] Getting a particular weekday for a given month

2014-04-07 Thread Boris Steipe
Something like: # the third Wednesday m <- as.Date("2014-04-01") format(m+which(format(m+0:30,"%a") == "Wed")[3]-1, "%a %b %d") # or eg. all Tuesdays format(m+which(format(m+0:30,"%a") == "Tue")-1, "%a %b %d") # or eg. the last Friday wd <- which(format(m+0:30,"%a") == "Fri")-1 format(m+wd[lengt

[R] Getting a particular weekday for a given month

2014-04-07 Thread Christofer Bogaso
Hi, Given a month name, I am looking for some script to figure out, what is the date for 3rd Wednesday. For example let say I have following month: library(zoo) Month <- as.yearmon(as.Date(Sys.time())) I need to answer: What is the date for 3rd Wednesday of 'Month'? Really appreciate for any po