Setting default calendar in .Rprofile

Setting default calendar in .Rprofile

That's the way I use bizdays, I set the default.calendar in my .Rprofile. Since I am always using holidaysANBIMA holidays I create and set the default calendar in my .Rprofile.

library(bizdays)
create.calendar(name='ANBIMA', holidays=holidaysANBIMA, weekdays=c('saturday', 'sunday'))
bizdays.options$set(default.calendar='ANBIMA')

If you put these 3 lines of code at the end of your .Rprofile you don't have to instantiate the calendar every time you use bizdays. You can simply

from_dates <- c('2013-07-12', '2012-06-13')
to_dates <- seq(as.Date('2014-02-17'), as.Date('2016-07-21'), by='months')
bizdays(from_dates, to_dates)

And it works with any of bizdays functions:



Try the bizdays package in your browser

Any scripts or data that you put into this service are public.

bizdays documentation built on April 19, 2021, 9:06 a.m.