Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python运行R_Python_R - Fatal编程技术网

从Python运行R

从Python运行R,python,r,Python,R,我需要从Python运行R脚本,下面是使用的代码: R代码: # max.R myArgs<-commandArgs(trailingOnly=TRUE) nums=as.numerics(myArgs) cat(max(nums)) 当我执行Python代码时,它会引发一个错误: E:\...\codes>python run_max.py Error in as.numerics(myArgs) : impossible de trouver la fonction "a

我需要从
Python
运行
R脚本
,下面是使用的代码:

R代码:

# max.R

myArgs<-commandArgs(trailingOnly=TRUE)
nums=as.numerics(myArgs)
cat(max(nums))
当我执行Python代码时,它会引发一个错误:

E:\...\codes>python run_max.py
Error in as.numerics(myArgs) :
  impossible de trouver la fonction "as.numerics"
Exécution arrêtée
Traceback (most recent call last):
  File "run_max.py", line 16, in <module>
    x=subprocess.check_output(cmd,universal_newlines=True)
  File "C:\Python2713\lib\subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['Rscript', 'E:/.../codes/max.R', '11', '3', '9', '42']' returned non-zero exit status 1
E:\…\code>python运行\u max.py
as.numerics(myArgs)中的错误:
不可能的“数字”
执行协议
回溯(最近一次呼叫最后一次):
文件“run_max.py”,第16行,在
x=子流程。检查输出(cmd,universal\u newlines=True)
文件“C:\Python2713\lib\subprocess.py”,第219行,在check\u输出中
引发被调用的进程错误(retcode,cmd,output=output)
subprocess.CalledProcessError:命令“['Rscript”,“E:/…/codes/max.R”,“11”,“3”,“9”,“42']”返回非零退出状态1

问题不在
python
中,问题不在命令
as.numerics(myArgs)
中,它应该是
as.numeric(myArgs)
真是我的耻辱哈哈哈,谢谢,不用担心,我们不会告诉任何人……问题不在
python
中,而是在命令
as.numerics(myArgs)
中,它应该是
as.numeric(myArgs)
真为我感到羞耻哈哈哈,谢谢你不用担心我们不会告诉任何人。。。
E:\...\codes>python run_max.py
Error in as.numerics(myArgs) :
  impossible de trouver la fonction "as.numerics"
Exécution arrêtée
Traceback (most recent call last):
  File "run_max.py", line 16, in <module>
    x=subprocess.check_output(cmd,universal_newlines=True)
  File "C:\Python2713\lib\subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['Rscript', 'E:/.../codes/max.R', '11', '3', '9', '42']' returned non-zero exit status 1