Hi, For US holidays, the timeDate package in Rmetrics has a function holidayNYSE() to which you pass a numeric range for years, e.g. holidayNYSE(1980:1990).
Cheers, Murali -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mark Knecht Sent: 06 January 2011 17:19 To: R-Finance Subject: [R-SIG-Finance] Create a Monday-Friday time series? Hi, I think I'm going to have a couple of questions but I figured I'd start with (I hope) a very simple one. I've not worked with time series objects before so I'm trying to learn them. I've been looking at things like ?xts, ?zoo as well as Phil Proctor's book but so far no luck. Starting from this little code stub I'd like to create a Monday through Friday time series into which I can eventually place trading system results. Here's the stub: TStoDate = function (TSDate) { X = strptime(TSDate + 19e6L, "%Y%m%d") return(as.Date(X)) } # TradeStation date format FirstDate = 1100401 LastDate = 1100601 #Dates StartDate = TStoDate(FirstDate) EndDate = TStoDate(LastDate) StartDate EndDate How can I do this, and (if possible and easy) is there a way to exclude U.S. holidays? I did discover R1 <- as.zoo(StartDate:EndDate ) does create an object, but the values are numbers which I don't understand but suspect are some internal R code for a date, and it appears to have enough entries to include weekends. Anyway, hopefully this is clear enough to describe what I'm trying to do and where I'm stuck. Thanks, Mark _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
