❶ 學校Linux伺服器上如何跑R腳本
只需要在R腳本首行,加入下圖中的代碼即可:
R --no-save <mergefiles.r
nohupR[options] [< infile] [> outfile]
nohup 後台運行程序
options:
--version查看R版本;
--slave只列印R腳本的輸出,而不顯示腳本具體執行情況;
--vanilla是--no-save,--no-restore,--no-site-file,--no-init-file和--no-environ的綜合;
--args後面是需要傳遞的參數。
注意:options必須選擇--save,--no-save, --vanilla三個中的一個。
比如編輯一個mergefiles.r文件如下:
R --slave --vanilla <mergefiles.r