Alexandre Ludolf Alexandre Ludolf - 3 months ago 17
R Question

R bizdays trouble making it work

Im tring to use the bizdays package to generate a vector with bus days between two dates.

fer = as.data.frame(as.Date(fer[1:938]))

#Define default calendar
bizdays.options$set(default.calendar=fer)

dt1 = as.Date(Sys.Date())
dt2 = as.Date(Sys.Date()-(365*10)) #sample 10 year window

#Create date vector
datas = bizseq(dt2, dt1)


i get this error: "Error in bizseq.Date(dt2, dt1) : Given date out of range."
the same behavior for any function bizdays et al.

any ideas?

Answer

If fer is the holidays, you can try with:

bizdays.options$set(default.calendar=Calendar(holidays=fer))
Comments