I have a few work flows where I would like R to halt the Linux machine it\'s running on after completion of a script. I can think of two similar ways to do this:
sudo is an option -- it allows you to run certain commands without prompting for any password. Just put something like this in /etc/sudoers
sudo
/etc/sudoers
ALL=(ALL) PASSWD: ALL, NOPASSWD: /sbin/halt
(of course replacing with the name of user running R) and system('sudo halt') should just work.
system('sudo halt')