Scheduling R Script

ETD picture ETD · May 8, 2010 · Viewed 83.9k times · Source

I have written an R script that pulls some data from a database, performs several operations on it and post the output to a new database.

I would like this script to run every day at a specific time but I can not find any way to do this effectively.

Can anyone recommend a resource I could look at to solve this issue? I am running this script on a Windows machine.

Answer

petermeissner picture petermeissner · Feb 4, 2014

Actually under Windows you do not even have to create a batch file first to use the Scheduler.

  • Open the scheduler: START -> All Programs -> Accesories -> System Tools -> Scheduler
  • Create a new Task
  • under tab Action, create a new action
  • choose Start Program
  • browse to Rscript.exe which should be placed e.g. here:
    "C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe"
  • input the name of your file in the parameters field
  • input the path where the script is to be found in the Start in field
  • go to the Triggers tab
  • create new trigger
  • choose that task should be done each day, month, ... repeated several times, or whatever you like