Guest User

Untitled

a guest
Nov 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. thedate | weekdays
  2. -----------+--------------------------
  3. 2017-11-21 | 0
  4. 2017-11-22 | 195
  5. 2017-11-23 | 390
  6. 2017-11-24 | 585
  7. 2017-11-25 | 585 (because it's a saturday)
  8.  
  9. dates <- as.Date("2017-11-21"):as.Date("2020-11-20")
  10. forecasting <- data.frame(thedate = as.Date(dates, origin = "1970-01-01"))
  11. forecasting$weekdays <- 195 * sum(!weekdays(seq(Sys.Date(), forecasting$thedate, "days")) %in% c("Saturday", "Sunday"))
Add Comment
Please, Sign In to add comment