Thanks Gabor. That seems to work nicely. What is chron trying to tell me about the origin? Is that specific to my machine or did you see it also?
I am using 2.12.1. Also, what's the command to package up some real data from a data.frame so that it survives being emailed? When I respond back later I want to include a few real trades so you can recreate whatever I'm seeing. Cheers, Mark On Thu, Jan 6, 2011 at 9:55 AM, Gabor Grothendieck <[email protected]> wrote: <SNIP> > To add to this try: > > library(timeDate) # holidayNYSE > library(chron) # .Holidays / is.holiday / is.weekend > > # this will be used by is.holiday > .Holidays <- chron(as.Date(holidayNYSE(year = 2010))) > > StartDate <- as.Date("2010-01-01") > EndDate <- as.Date("2010-04-01") > > dd <- seq(StartDate, EndDate, by = "day") > > dd[!is.weekend(dd) & !is.holiday(dd)] > <SNIP> > library(timeDate) # holidayNYSE > library(chron) # .Holidays / is.holiday / is.weekend > > # this will be used by is.holiday > .Holidays <- chron(as.Date(holidayNYSE(year = 2010))) Error in convert.dates(dates., format = fmt, origin. = origin.) : object dates. must be numeric or character > > StartDate <- as.Date("2010-01-01") > EndDate <- as.Date("2010-04-01") > > dd <- seq(StartDate, EndDate, by = "day") > > dd[!is.weekend(dd) & !is.holiday(dd)] [1] "2010-01-01" "2010-01-04" "2010-01-05" "2010-01-06" "2010-01-07" [6] "2010-01-08" "2010-01-11" "2010-01-12" "2010-01-13" "2010-01-14" [11] "2010-01-15" "2010-01-18" "2010-01-19" "2010-01-20" "2010-01-21" [16] "2010-01-22" "2010-01-25" "2010-01-26" "2010-01-27" "2010-01-28" [21] "2010-01-29" "2010-02-01" "2010-02-02" "2010-02-03" "2010-02-04" [26] "2010-02-05" "2010-02-08" "2010-02-09" "2010-02-10" "2010-02-11" [31] "2010-02-12" "2010-02-15" "2010-02-16" "2010-02-17" "2010-02-18" [36] "2010-02-19" "2010-02-22" "2010-02-23" "2010-02-24" "2010-02-25" [41] "2010-02-26" "2010-03-01" "2010-03-02" "2010-03-03" "2010-03-04" [46] "2010-03-05" "2010-03-08" "2010-03-09" "2010-03-10" "2010-03-11" [51] "2010-03-12" "2010-03-15" "2010-03-16" "2010-03-17" "2010-03-18" [56] "2010-03-19" "2010-03-22" "2010-03-23" "2010-03-24" "2010-03-25" [61] "2010-03-26" "2010-03-29" "2010-03-30" "2010-03-31" "2010-04-01" > _______________________________________________ [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.
