RをPythonに組み込むことができる.それにインターフェースもちゃんとしてる.こいつはクールだぜ.
>>> import rpy2.robjects as robjects
>>> robjects.r
<rpy2.robjects.R object at 0xa189ccc>
>>> print robjects.r
<rpy2.robjects.R object at 0xa189ccc>
platform: i686-pc-linux-gnu
arch: i686
os: linux-gnu
system: i686, linux-gnu
status:
major: 2
minor: 15.1
year: 2012
month: 06
day: 22
svn rev: 59600
language: R
version.string: R version 2.15.1 (2012-06-22)
nickname: Roasted Marshmallows
>>> robjects.r.pi
<FloatVector - Python:0xa189e0c / R:0xaa2dff0>
[3.141593]
>>> robjects.r.pi[0]
3.141592653589793
>>> robjects.r.letters
<StrVector - Python:0xa19228c / R:0xa87e2a0>
['a', 'b', 'c', ..., 'x', 'y', 'z']
>>> robjects.r.letters[0:]
<StrVector - Python:0xa19290c / R:0xa87e3d0>
['a', 'b', 'c', ..., 'x', 'y', 'z']
>>> robjects.r.letters[0]
'a'
>>> robjects.r.letters[1]
'b'
>>> robjects.r('pi')
<FloatVector - Python:0xa192aec / R:0xaa2dff0>
[3.141593]
>>> robjects.r('x <- 4')
<FloatVector - Python:0xa192e6c / R:0xaa2ddd0>
[4.000000]
>>> robjects.r('x')
<FloatVector - Python:0xa192dec / R:0xaa2ddd0>
[4.000000]
>>> robjects.r['x']
<FloatVector - Python:0xa1929ec / R:0xaa2ddd0>
[4.000000]
>>> [ee for ee in robjects.r.letters]
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']