コード例 #1
0
 def testFunctionCall(self):
     rpy.set_default_mode(rpy.BASIC_CONVERSION)
     # positional only
     three = rpy.r.sum(1,2)
     three = three[0] # is this what is happening w/ rpy, or the list is
     # ...automatically dropped ?
     self.assertEquals(3, three)
     # positional + keywords
     onetwothree = rpy.r.seq(1, 3, by=0.5)
     self.assertEquals([1.0, 1.5, 2.0, 2.5, 3.0], onetwothree)
コード例 #2
0
 def testAttributeExpansion(self):
     rpy.set_default_mode(rpy.BASIC_CONVERSION)
     wtest = rpy.r.wilcox_test
     self.assertTrue(isinstance(wtest, rpy.Robj))
コード例 #3
0
 def testSexp(self):
     rpy.set_default_mode(rpy.NO_CONVERSION)
     pi = rpy.r.pi
     self.assertTrue(isinstance(pi.sexp, rpy3.rinterface.Sexp))
     self.assertRaises(AttributeError, setattr, pi, 'sexp', None)
コード例 #4
0
 def testCallable(self):
     rpy.set_default_mode(rpy.NO_CONVERSION)
     #in rpy-1.x, everything is callable
     self.assertTrue(callable(rpy.r.seq))
     self.assertTrue(callable(rpy.r.pi))
コード例 #5
0
 def testFunctionCallWithRObj(self):
     rpy.set_default_mode(rpy.NO_CONVERSION)
     onetwo = rpy.r.seq(1, 2)
     three = rpy.r.sum(onetwo)
     rpy.set_default_mode(rpy.BASIC_CONVERSION)
     self.assertEquals(3, three.sexp[0])
コード例 #6
0
ファイル: test_rpy.py プロジェクト: cdcutler/r-orange
import rpy3.rpy_classic as rpy

rpy.set_default_mode(rpy.BASIC_CONVERSION)
a = rpy.r("1")

a.as_py()