[R-SIG-Finance] timeLastNdayInMonth returns with a date in the next month

jbasu jyotibasu.c at gmail.com
Sun Feb 10 06:21:17 CET 2013


Hi,

I am trying to use the timeDate package and function timeLastNdayInMonth to
get the last Friday of the month. But when I call the function I get an
output date in the next month which is incorrect.

> library(timeDate)
> timeLastNdayInMonth("1996-05-01", 2)
America/New_York
[1] [1996-06-04]

I ran this on my machine as well as on http://pbil.univ-lyon1.fr/Rweb/ just
to make sure I did not have a messed up installation. 

Is there a bug in this function or should I be using some different function
for this purpose?

Also if the last Friday is a trading day, I would like to get the prior
trading day. I can write a loop to check this date against the list of
trading days in that month. Is there already some function or more efficient
way to do this?

Thanks for your help,
jbasu




--
View this message in context: http://r.789695.n4.nabble.com/timeLastNdayInMonth-returns-with-a-date-in-the-next-month-tp4658068.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list