0

I am trying to add a business day to some dates but cannot seem to get it right. What I have currently is:

 d$plusOneBusinessDay <- AllDays + 1

or

 d$plusOneBusinessDay <- AllDays + days(1) # adds one day but also adds weekend and holidays
 d$plusOneBusinessDay <- AllDays + wday(1) # addes one week

I am only interested in business days, so if something occurs on a Friday I want to roll it over to the monday. I have been looking at lubridate and timedate also RQuantLib but cannot get it working.

Any help would be great!

Data:

d <- data.frame(AllDays=seq(as.Date("2012-01-01"),
                             as.Date("2015-08-18"),"day"))
user8959427
  • 2,027
  • 9
  • 20
  • 3
    try with `bizdays` – akrun Jul 27 '19 at 19:53
  • Sweet thanks! This seems to work on my data: `create.calendar(name="mycal", weekdays=c('saturday', 'sunday'))` Then `... mutate(plusone_date = offset(orig_date, 1, "mycal"))… ` – user8959427 Jul 27 '19 at 20:17
  • 1
    This post helped: https://stackoverflow.com/questions/26749336/adding-15-business-days-in-lubridate "Check 2018 Update" – user8959427 Jul 27 '19 at 20:18

0 Answers0