Skip to content
Prev 294895 / 398503 Next

Windows Task Scheduler and R updates. Need basic tips

Hi Paul,

This is a bit OT, but here's what I would do.

1) write the R script (or if updating packages is all you want Rscript
-e "update.packages(repos = 'yourrepo', ask = FALSE)" would do it
without need for a script)

2) write a silly batch file (e.g., Rupdate.bat) wrapper (maybe there
are better ways, but this is easy) that contains the command to have R
execute the R script (becomes slightly less silly if for example you
have multiple versions of R and would like to update all of them, then
the batch file could go through systemattically).  If you care, you
can redirect stderror and stdout from the batch file to any file you
choose.

3) With appropriate privileges run (untested):

  schtasks /Create /SC DAILY /TN Rupdate /TR c:/path/to/Rupdate.bat /ST 19:00

which would create a task Rupdate that would run daily at 19:00 and
execute Rupdate.bat.

Cheers,

Josh
On Thu, May 17, 2012 at 10:28 AM, Paul Johnson <pauljohn32 at gmail.com> wrote: