Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- thedate | weekdays
- -----------+--------------------------
- 2017-11-21 | 0
- 2017-11-22 | 195
- 2017-11-23 | 390
- 2017-11-24 | 585
- 2017-11-25 | 585 (because it's a saturday)
- dates <- as.Date("2017-11-21"):as.Date("2020-11-20")
- forecasting <- data.frame(thedate = as.Date(dates, origin = "1970-01-01"))
- forecasting$weekdays <- 195 * sum(!weekdays(seq(Sys.Date(), forecasting$thedate, "days")) %in% c("Saturday", "Sunday"))
Add Comment
Please, Sign In to add comment