rpy2.rpy_classic is currently lagging behind the other rpy2.* modules (in terms of reliability).
You have hit a bug. It should be fixed some time soon. L. On Tue, 2008-10-28 at 11:43 +1000, Denham Robert wrote: > I am having problems with rp2.rpy_classic with conversions. If I do: > > > $ python > Python 2.5.2 (r252:60911, Aug 20 2008, 17:14:32) > [GCC 4.1.2 20070115 (prerelease) (SUSE Linux)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from rpy2.rpy_classic import * > >>> set_default_mode(NO_CONVERSION) > >>> x = r.seq(1, 3, by=0.5) > >>> print x > <rpy2.rpy_classic.Robj object at 0x2ba5a898c710> > >>> > >>> set_default_mode(BASIC_CONVERSION) > >>> x = r.seq(1, 3, by=0.5) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rpy_ > classic.py", line 215, in __call__ > res = rpy2py(res) > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rpy_ > classic.py", line 174, in rpy2py > res = rpy2py_basic(obj) > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rpy_ > classic.py", line 154, in rpy2py_basic > if obj.typeof() in [ri.INTSXP, ri.REALSXP, ri.CPLXSXP, > TypeError: 'int' object is not callable > >>> > > > So with no conversion I can use seq(1,3), but with basic conversion I > can't seem to. I am using python 2.5.2, R-2.8.0 on Suse x86_64. Any > suggestions as to why the conversion doesn't work? > > I have tried other examples, like > > $ python > Python 2.5.2 (r252:60911, Aug 20 2008, 17:14:32) > [GCC 4.1.2 20070115 (prerelease) (SUSE Linux)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import rpy2.robjects as robjects > >>> x = robjects.r.seq(1, 10) > >>> print x > [1] 1 2 3 4 5 6 7 8 9 10 > >>> x.r[-1] > 2:10 > >>> > > and they work fine. > > I did the test of the install and got results like this: > $ python > Python 2.5.2 (r252:60911, Aug 20 2008, 17:14:32) > [GCC 4.1.2 20070115 (prerelease) (SUSE Linux)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import rpy2.tests > >>> import unittest > >>> tr = unittest.TextTestRunner(verbosity = 1) > >>> suite = rpy2.tests.suite() > >>> tr.run(suite) > ..................Error in .Primitive("[")(0:10, list("a", "b", "c")) : > invalid subscript type 'list' > > ....................................................E..F....Loading > required package: splines > > ..................Error in function (x) : object "y" not found > > ...Error in .Primitive("sum")(c("a", "b", "c", "d", "e", "f", "g", "h", > "i", : > invalid 'type' (character) of argument > > ......F...................................... > ====================================================================== > ERROR: testNewString > (rpy2.rinterface.tests.test_SexpVector.SexpVectorTestCase) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rint > erface/tests/test_SexpVector.py", line 95, in testNewString > ri.NA_STRING[0] > ValueError: Cannot handle type 9 > > ====================================================================== > FAIL: testNewWithoutInit > (rpy2.rinterface.tests.test_SexpVector.SexpVectorTestCase) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rint > erface/tests/test_SexpVector.py", line 37, in testNewWithoutInit > self.assertTrue(False) # worked when tested, but calling > endEmbeddedR causes trouble > AssertionError > > ====================================================================== > FAIL: testCallErrorWhenEndedR > (rpy2.rinterface.tests.test_EmbeddedR.EmbeddedRTestCase) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/opt/freeware/Python/Python-2.5.2/lib/python2.5/site-packages/rpy2/rint > erface/tests/test_EmbeddedR.py", line 30, in testCallErrorWhenEndedR > self.assertTrue(False) # worked when tested, but calling > endEmbeddedR causes trouble > AssertionError > > ---------------------------------------------------------------------- > Ran 144 tests in 0.195s > > FAILED (failures=2, errors=1) > <unittest._TextTestResult run=144 errors=1 failures=2> > > > ************************************************************************ > The information in this email together with any attachments is > intended only for the person or entity to which it is addressed > and may contain confidential and/or privileged material. > Any form of review, disclosure, modification, distribution > and/or publication of this email message is prohibited, unless > as a necessary part of Departmental business. > If you have received this message in error, you are asked to > inform the sender as quickly as possible and delete this message > and any copies of this message from your computer and/or your > computer system network. > ************************************************************************ > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list