完成脚本后关闭电脑

shutdown PC after finishing a script

我在 R 中运行一个脚本需要花费很多时间。我希望我的电脑在完成我的脚本后自动关闭。那可能吗?我怎样才能使用 R 做到这一点? 我为此搜索了包和函数,但找不到。 谢谢 P.S。我的电脑 运行 Windows 8.1

可以直接从R调用cmd提示符

system('shutdown -s')

您可以在此处查看其他关机命令:。如果您想执行其他任务,这可能会有用。