Skip to content

Instantly share code, notes, and snippets.

@dwhdai
Created May 16, 2019 22:09
Show Gist options
  • Save dwhdai/0ecca8cb8d9492a267b4c1d27e8ca4c9 to your computer and use it in GitHub Desktop.
Save dwhdai/0ecca8cb8d9492a267b4c1d27e8ca4c9 to your computer and use it in GitHub Desktop.
Schedule an R script to run
# Path to script that should be sourced
rscript <- "path_to_script/script_name.R"
# To create the task
taskscheduleR::taskscheduler_create(taskname = basename(rscript),
rscript = rscript,
schedule = c("DAILY"), # Set schedule frequency
starttime = "08:00", # Set schedule start time
startdate = format(as.Date("2019-04-26"), "%m/%d/%Y") # Set schedule start date
)
# To delete the task
taskscheduleR::taskscheduler_delete("script_name.R")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment