10

I'm runnig a script in R that takes many hours. I woud like that my PC automatically shutdown itself after finish my script. Is that possible? How can I do that using R? I've searched for packages and functions for that, but I couldn't find. Thank you P.S. My PC s running Windows 8.1

Tiago
  • 143
  • 1
  • 2
  • 7
  • 1
    R can call commands using `?system` functions - maybe try something like those listed here: http://superuser.com/questions/674087/how-to-shut-down-a-windows-8-1-pro-computer-in-remote-session – thelatemail Apr 21 '15 at 02:11

1 Answers1

15

You can call the cmd prompt directly from R

system('shutdown -s')

You can view other shutdown commands here: https://stackoverflow.com/a/162305/1362215. This may be useful if you want to perform other tasks.

Community
  • 1
  • 1
Max Candocia
  • 4,294
  • 35
  • 58
  • 2
    Executing system("shutdown") will show all available options for shutting your computer down from R, like rebooting, hibernating... – David Nov 15 '19 at 13:44