>>> import rpy >>> >>> rpy.set_default_mode(rpy.NO_CONVERSION) >>> >>> x = [ [1, 2, 3], [1, 2, 3] ] >>> y = rpy.r.t(x) >>> y.as_py(rpy.BASIC_CONVERSION) [[1, 2, 3], [1, 2, 3]] >>>
I want to transpose x in the above code. But it does not do so. How should I fix it? Regards, Peng On Mon, Sep 28, 2009 at 12:38 PM, Warnes, Gregory R. <gregory.war...@rochester.edu> wrote: > The problem is that the R object returned from > "rpy.r.matrix(range(6),nr=2)" is being automatically converted to a > python object before being passed to the transpose function. > > The easiest solution is to turn off automatic conversion, and then > manually ask for conversion when you want it: > >>>> import rpy >>>> rpy.set_default_mode(rpy.NO_CONVERSION) >>>> x = rpy.r.t(rpy.r.matrix(range(6),nr=2)) >>>> x > <Robj object at 0x2a1b0> >>>> y = x.as_py(rpy.BASIC_CONVERSION) >>>> y > [[0, 1], [2, 3], [4, 5]] > > -Greg > >> -----Original Message----- >> From: Peng Yu [mailto:pengyu...@gmail.com] >> Sent: Sunday, September 27, 2009 12:57 PM >> To: RPy help,support and design discussion list >> Subject: [Rpy] Why rpy.r.t is not working >> >> Hi, >> >> I'm not sure why transposing a matrix is not working. Can somebody let >> me know what is going on here? >> >> >>> rpy.r.matrix(range(6),nr=2) >> [[0, 2, 4], [1, 3, 5]] >> >>> rpy.r.t(rpy.r.matrix(range(6),nr=2)) >> [[0, 2, 4], [1, 3, 5]] >> >> Regards, >> Peng >> >> > ----------------------------------------------------------------------- >> ------- >> Come build with us! The BlackBerry® Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart >> your >> developing skills, take BlackBerry mobile applications to market and >> stay >> ahead of the curve. Join us from November 9-12, 2009. Register >> now! >> http://p.sf.net/sfu/devconf >> _______________________________________________ >> rpy-list mailing list >> rpy-list@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rpy-list > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list