1

How can I round the dates in the date column to the following business day? So each Saturday, Sunday and holiday should be transformed to the following business day. Furthermore, how can we include the output from the other columns as well in the transformation to following business days?

I tried this with the bizdays function:

TestDates <- RawTweetDataWSentiment
View(TestDates)

bizdays.options$set(default.calendar="UnitedKingdom/ANBIMA")

cal <- create.calendar("UnitedKingdom/ANBIMA", holidays=holidaysANBIMA, weekdays=c("saturday", "sunday"))

adjust.next(TestDates$Date, cal)

TestDates1 <- adjust.next(TestDates$Date, cal)
View(TestDates1)

This however only returns the date column

Does anyone know how to do this in R?

Frank_O
  • 37
  • 5
  • https://stackoverflow.com/questions/20709654/add-1-business-day-to-date-in-r Does this answer the question? What have you tried? – Jamie_B Apr 28 '20 at 13:59
  • Hi @Jamie_B I have tried to use the bizdays function which get the job done, but without including the additinal columns in the output with from my data set with my variables. I'll add my code to the original post/question. I'll try to visit the link and see if it helps. Thanks! – Frank_O Apr 28 '20 at 14:10
  • Assuming TestDates is a data frame, try this, TestDates$new_dates <- adjust.next(TestDates$Date, cal) This is essentially adding a new column to the original dataframe – Jamie_B Apr 28 '20 at 14:32
  • Thank you very much @Jamie_B! You saved my day – Frank_O Apr 28 '20 at 16:17

0 Answers0