easy_install
and have:
R version 2.10.0 (2009-10-26)
[R.app GUI 1.30 (5511) x86_64-apple-darwin9.8.0]
rpy2 2.1.7-20101104
Let's re-run the example from the other day:
which launches an X11 window for the plot and also prints a summary of the results. The
result
variable is:Help on Vector in module rpy2.robjects.vectors object (in part):
It has
__getitem__
.Since it's a
Vector
, that sounds like it should behave like a list rather than a dictionary, and consistent with that we cannot retrieve items by name, only by index:The thing we were missing previously was a way to associate the components of the R list (like posterior, mean, etc.) with the values in the result. I can see in the help(result) above what was suggested in Comments, which is the
names
attribute.result.names
is a StrVector
, and does not support index
, however it can be converted to a Python list easily enough:So I guess the thing is that the objects we're using are complex because we may still want to do R-like things with them, but they can be converted to standard Python types if you know the right attribute to access. In this case it should have been easy since that's the only one that really looks promising in the
help
. But the way, this is precisely the thing that bugs me the most about R, complex objects that I spend a long time trying to figure out how to take them apart to get what I want. We'll have to see how things go with more standard R lists etc.The documentation seems to be a bit dated, using for example this:
which doesn't work even substituting
rpy2
That sure looks like a bug.
[UPDATE: It's not.
/UPDATE]
But this works:
launched X11
We're directed to /examples in the distribution. Where is it? It's not in site-packages except in
.egg
formatI guess we'll go to the Demos linked on the main doc page.
One last example, which is not quite what I was hoping for!
plot(x,y)
looks the same. Hmmm...[ UPDATE: Solved! See here ]