这个函数调用R来运行R脚本(。r文件), and returns 'runR.log' in the same folder with the input R script file.
此代码仅在Windows环境中工作。它可以通过修改“FindRpath”在Mac中工作。
RscriptFileName:要运行的R脚本的路径+文件名。
'Rpath'(可选):安装'R.exe'的路径。例如:Rpath = 'C:\Program Files\R\R-3.1.1\bin';
如果没有提供'Rpath',将执行'FindRpath'在Windows Program Files文件夹中自动查找R的路径。
例子:
>> Rpath = 'C:\Program Files\R\R-3.1.1\bin';
>> RscriptFileName = 'D:\test\lm . r ';
>> RunRcode(RscriptFileName, Rpath);
或者只是>> RunRcode(RscriptFileName);
引用作为
陈伟荣(2023)。RunRcode (RscriptFileName Rpath)(//www.ru-cchi.com/matlabcentral/fileexchange/50071-runrcode-rscriptfilename-rpath), MATLAB中央文件交换。检索。