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

2009-11-19 Thread Laurent Gautier
I have forgotten one line before 'chisq_test = ro.r(code)': code = ''.join(code) L. Hao Fan wrote: > Cool, I will try the new source. Thanks a lot! > > > Hao > > >> This will not work. >> >> Since the problem was fixed in the R source, what about just using it ? >> >> # --- >> import urll

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

2009-11-19 Thread Hao Fan
Cool, I will try the new source. Thanks a lot! Hao > > This will not work. > > Since the problem was fixed in the R source, what about just using it ? > > # --- > import urllib > page = > urllib.urlopen("https://svn.r-project.org/R/branches/R-2-10-branch/src/library/stats/R/chisq.test.R";)

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

2009-11-19 Thread Laurent Gautier
This will not work. Since the problem was fixed in the R source, what about just using it ? # --- import urllib page = urllib.urlopen("https://svn.r-project.org/R/branches/R-2-10-branch/src/library/stats/R/chisq.test.R";) code = page.readlines() chisq_test = ro.r(code) # this will now work #

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

2009-11-19 Thread Hao Fan
Hi, Laurent and list, Thanks a lot for all the informations! I read through your discussions at https://stat.ethz.ch/pipermail/r-devel/2009-November/055701.html So it is a R problem not rpy. :-) I tried to work around this problem using the following code: -

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

2009-11-19 Thread Laurent Gautier
This seems fixed in R-devel (r50493), and the fix will be included in R-2.10.1 L. Laurent Gautier wrote: > > As suspected this is a problem in the R function chisq.test() > (and this also at the R level). > > https://stat.ethz.ch/pipermail/r-devel/2009-November/055701.html > > > > L. >

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

2009-11-19 Thread Laurent Gautier
As suspected this is a problem in the R function chisq.test() (and this also at the R level). https://stat.ethz.ch/pipermail/r-devel/2009-November/055701.html L. Laurent Gautier wrote: > This is odd. > When looking at what is happening, the problem is likely rooted in > the use of deparse(

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