Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you are working on a Windows computer and want to schedule your R scripts while you are off running, sleeping or having a coffee break, the taskscheduleR package might be what you are looking for.

The taskscheduleR R package is available at https://github.com/jwijffels/taskscheduleR and it allows R users to do the following:

i) Get the list of scheduled tasks

– A task is basically a script with R code which is run through Rscript

– You can schedule tasks ‘ONCE’, ‘MONTHLY’, ‘WEEKLY’, ‘DAILY’, ‘HOURLY’, ‘MINUTE’, ‘ONLOGON’, ‘ONIDLE’

– After the script has run, you can check the log which can be found at the same folder as the R script. It contains the stdout & stderr of the Rscript.

Below, you can find an example how you can schedule your R script once or daily in the morning.
library(taskscheduleR)
myscript <- system.file("extdata", "helloworld.R", package = "taskscheduleR")

## run script once within 62 seconds
schedule = "ONCE", starttime = format(Sys.time() + 62, "%H:%M"))
## run script every day at 09:10
schedule = "DAILY", starttime = "09:10")


• When the task has run, you can look at the log which contains everything from stdout and stderr. The log file is located at the directory where the R script is located.
## log file is at the place where the helloworld.R script was located