[R] Converting tables to matrices

Michael Bedward michael.bedward at gmail.com
Mon Sep 20 03:15:57 CEST 2010


Hi Luke,

Easy-peasy...  If you have...

result <- fisher.test( some_data )

Then you can get the probability with...

result$p.value

So in your case just modify the apply statement in the previous post to...

pvalues <- apply( x, 1, function(xrow) fisher.test( matrix(xrow,
nrow=2) )$p.value )

Michael


On 20 September 2010 10:59, selthy <selthy at hotmail.com> wrote:
>
> Hi Michael,
> I have another simple question which I'm sure you could help me with. How do
> I extract only the p values from "result" (i.e. all of the p values from the
> i tests, preferably in a single column of data)? I've read over the
> fisher.test help
> (http://127.0.0.1:16311/library/stats/html/fisher.test.html) but can't find
> out how to do this. Thanks again for your help.
> Cheers,
> Luke
> --
> View this message in context: http://r.789695.n4.nabble.com/Converting-tables-to-matrices-tp2543309p2546416.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list