
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2100 fd906abe-77d9-0310-91a1-e0d9ade77398
42 lines
1.1 KiB
Text
42 lines
1.1 KiB
Text
==================================================
|
|
Using the R Statistics Package with Python Scripts
|
|
==================================================
|
|
|
|
>>> from cybertools.pyscript.tests import Root
|
|
>>> from cybertools.pyscript.script import PythonScript
|
|
|
|
>>> pp = PythonScript()
|
|
>>> pp.__parent__ = Root()
|
|
>>> pp.__name__ = 'pp'
|
|
>>> request = None
|
|
|
|
>>> pp.setSource(u"return 'Hello World'")
|
|
>>> pp(request)
|
|
'Hello World'
|
|
|
|
>>> source = """
|
|
... data = [('r1', 'c1', 1),
|
|
... ('r1', 'c2', 1),
|
|
... ('r1', 'c3', 0),
|
|
... ('r2', 'c1', 0),
|
|
... ('r2', 'c2', 1),
|
|
... ('r2', 'c3', 1),
|
|
... ('r3', 'c1', 0),
|
|
... ('r3', 'c2', 1),
|
|
... ('r3', 'c3', 0),
|
|
... ('r4', 'c1', 1),
|
|
... ('r4', 'c2', 1),
|
|
... ('r4', 'c3', 1),
|
|
... ('r5', 'c3', 1),
|
|
... ]
|
|
... matrix = rstat.getDataFrame(data)
|
|
... #return matrix
|
|
... #return rstat.intermediateData
|
|
... x = rpy.with_mode(rpy.BASIC_CONVERSION, r.descript)(matrix)
|
|
... return x
|
|
... """
|
|
>>> pp.setSource(source)
|
|
>>> result = pp(request)
|
|
<BLANKLINE>
|
|
This is package 'ltm' ...
|
|
<BLANKLINE>
|