[R] access assigned objects

From: Beth Wilmot <wilmotb_at_ohsu.edu>
Date: Fri 12 Aug 2005 - 13:16:42 EST


Dear list,
I am trying to write a function that will make a matrix of each row of a data frame (4 columns), calculate a fisher.test on each resulting matrix and assign a vector of the p-values. I have gotten through making the matrices, but cannot calculate the fisher.test.  

fm<-function(x)
{dfrow<-nrow(x)  

mm <- vector("list", dfrow)
for(i in 1:dfrow)

   mm[[i]] <- matrix(x[i,],nr=2)

}  

I don't know how to access each mm[[i]] as everything I've tried gives me the error that "Error in fisher.test(mm[[i]]) : all entries of x must be nonnegative and finite"  

All the numbers in the matrices are between 1 and 600.    

Thanks,
Beth

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 12 13:24:47 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:47 EST