[R] Identifying US holidays

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Mon Aug 1 21:45:39 CEST 2011


Hello!

I am trying to identify which ones of a vector of dates are US
holidays. And, ideally, which is which. And I do not know (a-priori)
which dates those should be.
I have, for example:
 x<-seq(as.Date("2011-01-01"),as.Date("2011-12-31"),by="day")
(x)

I think chron should help me here - but maybe I am not using it properly:

library(chron)
is.holiday(chron) # Says that none of those dates are holidays

?is.holiday says: "holidays" is an object that should be listing
holidays. But I want to figure out which of my dates are US holidays
and don't want to provide a list of

Package timeDate does almost what I need:
library(timeDate)
holidayNYSE(2008:2010)
holidayNYSE()

However, I don't need all the NYSE holidays (like Good Friday). Just
the major US holidays - New Years, MLK, Memorial Day, Independence
Day, Labor Day, Halloween, Thanksgiving, Christmas.
Is there any way to identify major US holidays?

Thanks a lot!

-
Dimitri Liakhovitski
marketfusionanalytics.com



More information about the R-help mailing list