Eloi Ribeiro wrote: > Hi Peter, > Thanks for answering. Unfortunately your suggestion doesn't work with > the version we are using (Python 2.4.3, R 2.4.1, Rpy 1.0 RC2). It seems > that chisq function is waiting for a matrix as a double and not as a > list. How can we solve this?
You are right - you gave chisq.test as list-of-lists-of-integers, when it expected an array or matrix. Have you install either numpy or the older Numeric python library? They are recommended for use with rpy, as they add an array class to python. What I get is: >>> from rpy import r >>> c1=[386,385,383] >>> c2=[113,117,117] >>> c=r.cbind(c1,c2) >>> c array([[386, 113], [385, 117], [383, 117]]) >>> r.chisq_test(c)["p.value"] 0.9535284154083411 Note that rpy has returned "c" as a python array, but you got a list-of-lists-of-integers. 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 rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list