Hi all,

I am new to python, R and rpy2. I having few errors when I am using
'fisher.test' function where I am struck now. Please help to fix these bugs.
My code for fisher.test goes this way

*from rpy2 import *
import rpy2.robjects as robjects
def fisherExact(a,b,c,d):
   v = [a,b,c,d]
   m = robjects.r['matrix'](v,2,2)
   s = robjects.r['fisher.test'](m)
   return s
*

Here the value of a=0,b=1,c=0 and d=1. so the matrix m should be like this

     [,1] [,2]
[1,] 0    0
[2,] 1    1

But I am getting an error like this

*File "/usr/lib64/python2.6/site-packages/rpy2/robjects/__init__.py", line
422, in __call__
    res = super(RFunction, self).__call__(*new_args, **new_kwargs)
rinterface.RRuntimeError: Error in function (x, y = NULL, workspace = 2e+05,
hybrid = FALSE, control = list(),  :
  all entries of 'x' must be nonnegative and finite*

clearly every element of matrix m is +ve but I don't know why I am getting
this error. I am using python 2.6,R-core-2.9.2-1 and rpy2.

Please help me in this regard.

Thanks,
Bhanu.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to