You might add your (Unix) username (which you use to log into the RStudio Server) to the /etc/sudoers
file with NOPASSWD
to allow such unsupervised action, for example:
username ALL = NOPASSWD: /sbin/shutdown
Then simply halt the computer with a system
call, for example:
system('sudo shutdown -h now', wait = FALSE)