Disable auto-update from R (Windows)

[This article was first published on [the] joint posterior distribution, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There are two major threats to complex MCMC estimations:
  • Wrong energy settings (hibernate after 2 hours of inactivity)
  • Automatic Updates (install updates at 3 a.m.)

I thought about the latter threat. At times, you may hand some R code to other co-workers, especially when you need to estimate lots of different models in a short period of time. If they have auto-updates enabled, your results are quickly in jeopardy. While automatically saving the workspace [if(rep==10000) save.image(“save.RData”)] is definitely a very good idea, deactivating automatic updates on windows is still important for long-term calculations.
Therefore I thought about ways to deactivate automatic updates from within R. A major obstacle is UAC (user account control) which turns your administrator account into something … with less right. Windows frequently asks for privilege elevation. Sadly, elevation does not work without further administrative tools, which you will not find on every PC around. Therefore I decided to use the “runas” command, which will ask the user for her password once.
Although this is not a perfect solution yet, it is also a very nice example on some interesting functions: paste, sub, system.

“runas” apparently does not work with “net stop” command, therefore a .bat file needs to be created which can be started using runas. The .bat is created from within R.

Random John reminded my that an option to turn auto update back on would be nice. Well, I added that.

To leave a comment for the author, please follow the link and comment on their blog: [the] joint posterior distribution.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)