[R] Identifying US holidays

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Mon Aug 1 22:24:49 CEST 2011


Don't know if this is sufficiently slick for this list (which never fails to impress me with quick and elegant solutions) but I would point out to you that GF is the only NYSE holiday falling in March or April so it shouldn't be hard to discard it if desired. 

Michael Weylandt

On Aug 1, 2011, at 4:18 PM, Dimitri Liakhovitski <dimitri.liakhovitski at gmail.com> wrote:

> Just to clarify - I realize that "major" is subjective here. Maybe I
> should say "most common".
> But maybe there is a way for me to select from a list of all NYSE
> holidays and flag only some of them?
> Just not sure how to do it...
> Thanks!
> Dimitri
> 
> On Mon, Aug 1, 2011 at 3:45 PM, Dimitri Liakhovitski
> <dimitri.liakhovitski at gmail.com> wrote:
>> 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
>> 
> 
> 
> 
> -- 
> Dimitri Liakhovitski
> marketfusionanalytics.com
> 
> ______________________________________________
> 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.



More information about the R-help mailing list