我正在尝试使用rpy2模块将.RData文件读取到python中。下面是代码
>>> from rpy2.robjects import r
>>> r.load("path to .rdata file")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\dell\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\rpy2\robjects\functions.py", line 170, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
File "C:\Users\dell\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\rpy2\robjects\functions.py", line 100, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
我目前正在使用Windows 7、64位计算机。请帮忙。
好的,看来我已经理解了这里的问题。
在指定.RData文件的路径的同时,我使用标准Windows(“ \”)目录分隔符指定了该路径,而r.load()(显然)无法识别该路径。但是,当我使用“ /”目录分隔符时,.rdata文件已成功加载。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句