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