import subprocess
Iterations = 10
command = 'C:/Program Files/R/R-3.4.3/bin/Rscript.exe'
path2script = 'C:/Users/a0266997/Documents/PossionDistribution.R'
args = [str(Iterations)]
cmd = [command, path2script] + args
subprocess.Popen(cmd)
当没有" + args"时,代码完全正常。在cmd行
然而,在添加" + args"之后,R脚本不会输出之前执行过的csv文件。有关如何将args从Python传递给R的任何提示? R代码应该如何(Iterations = as.numeric(cmd [2])是不对的)?我很感激