Automating R scripts under Windows

Setting up an automated job under Linux is a cinch thanks to cron. Doing the same under Windows is a little more tricky, but still eminently doable.

I found this tutorial helpful:

That got me 99% of the way there. I wrote a batch file to trigger the script. The critical element was changing to the correct location before invoking R.

@echo off
cd "C:\Users\AndrewCo\Projects\"
R CMD BATCH script.R