Eloi Ribeiro wrote:
> This same problem is described here:
> http://sourceforge.net/tracker/index.php?func=detail&aid=1602142&group_id=48422&atid=453021
>
>
That does look like the same issue - I personally haven't been affected
yet. Please add a note to the bug on sourceforge, with the versions
your os, rpy, r, python and Numeric. This may help the developers to
narrow down what exactly triggers the conversion failure:
> I do not understand the workaround described.
Something like this works in R,
x <- c(386, 113, 385, 117, 383, 117)
chisq.test(matrix(x, nrow=3, ncol=2, byrow=TRUE))$p.value
So, if we give R the simple list of integers (rather than trying to pass
an array), and get it to do the conversion to a matrix in pure R
(without converting it back into a python variable) by exploiting the
"execute a string" method:
>>> from rpy import *
>>> r.assign("x", [386, 113, 385, 117, 383, 117])
[386, 113, 385, 117, 383, 117]
>>> r('chisq.test(matrix(x, nrow=3, ncol=2, byrow=TRUE))$p.value')
0.9535284154083411
This should work - its one rpy cpding style to minimising data object
conversion between R and python: passing simple data to R, building the
complex objects in R and keeping them in R, and only passing out simple
values back to R.
This may not have been exactly what the bug reported had in mind - there
is more than one way to do this!
> Any suggestion?
You could try numpy instead of Numeric - worth a try at least.
You could use an older version of R - not ideal, especially if you want
to use recent packages.
Peter
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list