On Wed, 2009-04-29 at 07:59 +0200, Vadim Axel wrote: > Hi, > > Thanks for your help. I just didn't understand that rpy and rpy2 are > two completely different versions. So, I installed one of them and > read the manual of another. > > Now, I have more interesting problem: > > > Running the following code results with the error: "#TypeError: object > of type 'numpy.float32' has no 'len':" > from numpy import * > from rpy import * > y = array([1,2,3], dtype=float32) > x = array([4,5,6], dtype=float32) > print r.lsfit(x,y)['coefficients'] > > When I change my arrays to non-float, the code is working.: > y = array([1,2,3]) > x = array([4,5,6]) > > I am using: > > R: 2.7.0 > Python 2.5.4 > Numpy 1.3.0 > Rpy 1.0.3 > OS: Windows XP > > Any idea? Is there any chance in Rpy2 it will not happen?
>>> import rpy2.robjects as ro >>> import rpy2.robjects.numpy2ri >>> import numpy >>> x = numpy.array([1,2,3], dtype = numpy.float32) >>> y = numpy.array([4,5,6], dtype = numpy.float32) >>> print(ro.r.lsfit(x,y)).r['coefficients'] $coefficients Intercept X 3 1 > Thanks for help, > Vadim > > > > On Tue, Apr 28, 2009 at 6:12 AM, laurent <lgaut...@gmail.com> wrote: > > > > On Mon, 2009-04-27 at 23:42 +0200, Vadim Axel wrote: > > Hi, > > > > I tried to installed rpy on Windows XP and it looks that > something > > went wrong. As a matter of fact I am not sure that I didn't > confuse > > something with all these compatibility issues. I have the > following > > packages installed: > > Python 2.5 > > R 2.8.1 > > rpy2-2.0.3.win32-py2.5.exe > > pywin32-213.win32-py2.5.exe > > I also have added C:\Program Files\R\R-2.8.1\bin to my PATH > > > > I am getting the following error in Python command prompt: > > >>> from rpy2 import * > > >>> r > > Traceback (most recent call last): > > File "<interactive input>", line 1, in <module> > > NameError: name 'r' is not defined > > > > What do you I miss? > > > May be a quick look at the documentation ? > http://rpy.sourceforge.net/rpy2/doc/html/introduction.html > > > Thanks a lot for your help! > > > > Vadim > > > > > > > ------------------------------------------------------------------------------ > > Crystal Reports - New Free Runtime and 30 Day Trial > > Check out the new simplified licensign option that enables > unlimited > > royalty-free distribution of the report engine for > externally facing > > server and web deployment. > > http://p.sf.net/sfu/businessobjects > > _______________________________________________ rpy-list > mailing list rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list > > > ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list