Hi, once more my apologies if I'm missing the obvious...
The rpy2 documentation at http://rpy.sourceforge.net/rpy2/doc-2.1/html/numpy.html#high-level-interface states that the import of the numpy2ri module "alone is sufficient to switch an automatic conversion of numpy objects into rpy2 objects." Based on that, I would have expected that something like import numpy as np import rpy2.robjects.numpy2ri import rpy2.robjects as ro x = np.arange(-10., 10., 0.1) ro.globalenv["x"] = x works well. However, it generates the following error: File "numpy_1.py", line 7, in <module> ro.globalenv["x"] = x File "/opt/apps/lib/python2.5/site-packages/rpy2/robjects/__init__.py", line 166, in __setitem__ robj = conversion.py2ro(value) File "/opt/apps/lib/python2.5/site-packages/rpy2/robjects/__init__.py", line 143, in default_py2ro res = default_py2ri(o) File "/opt/apps/lib/python2.5/site-packages/rpy2/robjects/__init__.py", line 132, in default_py2ri raise(ValueError("Nothing can be done for the type %s at the moment." %(type(o)))) ValueError: Nothing can be done for the type <type 'numpy.ndarray'> at the moment. It's of course straightforward to cast the numpy array explicitly with ro.globalenv["x"] = ro.FloatVector(x) but why is this necessary? Wouldn' numpy2ri.py also need an inplementation of py2ro which makes sure that calls of conversion.py2ro are routed through the numpy aware version of py2ri? Many thanks, Christian. ------------------------------------------------------------------------------ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list