Re: [Rpy] problem when using chisq.test in rpy2

2009-11-18 Thread Laurent Gautier
This is odd. When looking at what is happening, the problem is likely rooted in the use of deparse(substitute(x)) and deparse(substitute(y)) in the code for chisq.test. This is what is happening: >>> f = robjects.r('''function(x) return(deparse(substitute(x)))''') >>> tuple(f(robjects.FloatVect

Re: [Rpy] problem when using chisq.test in rpy2

2009-11-18 Thread Hao Fan
Hi, List and Laurent, For the chisq function I tried to used through rpy2, I just did more test with the exact code as follows: -- import rpy2.robjects as robjects p1dist = [] p2dist = [] num = 17 for x in range(num): p1dist.append(x) p2dist

Re: [Rpy] problem when using chisq.test in rpy2

2009-11-18 Thread Hao Fan
Hi, Laurent, I test the "clean" code I you suggested. It works! You are right, I also have a few other functions defined together with this chisq calculation. Basicly they are file IOs written in normal python. So it seems those parts caused the problem but not the rpy part. Thanks a lot

Re: [Rpy] problem when using chisq.test in rpy2

2009-11-18 Thread Laurent Gautier
Hi Hao, The exact example that triggers the error may matter. I just tried the following with rpy2-2.1dev and it worked. x = robjects.FloatVector((1,2,3)) y = robjects.FloatVector((2,3,4)) res = robjects.r['chisq.test'](x, y) I only get the following Warning message: In function (x, y = NULL,

[Rpy] problem when using chisq.test in rpy2

2009-11-18 Thread Hao Fan
Hi, list I would like to calculate the fitness of two histograms, so I tried to use the chisq.test() in R through rpy2. The python code I have is as follows: --- import rpy2.robjects as robjects p1dist = [X1, X2, ... Xm] p2dist = [Y1, Y2, ... Ym] rp1dist = robjects.FloatVec