I'm using the Bioconductor suite (ALL dataset) and trying to conduct a t.test for each gene. The goal is to view gene expression differences between the sexes. I can get the basic t.test down with the following:
> males <- exprs[, pData(ALL)$sex == "M"]
> females<-exprs[, pData(ALL)$sex == "F"]
> t.test(males, females)
But when I try the apply function to extract a p-value for each gene the command never ends, just keeps going in an endless loop (I think).
pvals=apply(exprs,1,function(x) {t.test(x[males],x[females])$p.value})
here is a sample of the males, there are 12625 rows (i.e., probe IDs).
> males
01005 01010 04006 04007 04008
1000_at 7.597323 7.479445 7.384684 7.905312 7.065914
1001_at 5.046194 4.932537 4.922627 4.844565 5.147762
1002_f_at 3.900466 4.208155 4.206798 3.416923 3.945869
1003_s_at 5.903856 6.169024 6.116890 5.687997 6.208061