[BioC] Problem to store p-value of anova() method

Stefan McKinnon Høj-Edwards Stefan.Hoj-Edwards at agrsci.dk
Mon Sep 12 08:46:47 CEST 2011


Hi,

When in doubt, use the function `str` on a variable to see its structure:
> a <- anova(lm(y ~ x))
> str(a)
Classes 'anova' and 'data.frame':       2 obs. of  5 variables:
 $ Df     : int  1 8
 $ Sum Sq : num  6.89 6.29
 $ Mean Sq: num  6.886 0.787
 $ F value: num  8.75 NA
 $ Pr(>F) : num  0.0182 NA
 - attr(*, "heading")= chr  "Analysis of Variance Table\n" "Response: y"

Of this we can see, that the P-values are accessible via:
> a$"Pr(>F)"

There might be some built-in accessor-function but that is up to the reader.
`str` is useable on almost any variable, although in some cases it might flood your console when used on a larger, more complex object.

Kind regards,
Stefan McKinnon Høj-Edwards     Dept. of Genetics and Biotechnology
PhD student                     Faculty of Agricultural Sciences
stefan.hoj-edwards at agrsci.dk    Aarhus University
Tel.: +45 8999 1291             Blichers Allé 20, Postboks 50
Web: www.iysik.com              DK-8830 Tjele
                                Tel.: +45 8999 1900
                                Web: www.agrsci.au.dk



------------------------------

Message: 2
Date: Sun, 11 Sep 2011 04:26:19 +0200
From: ANIRBAN BHAR <aec.ani at gmail.com>
To: bioconductor at r-project.org
Subject: [BioC] Problem to store p-value of anova() method
Message-ID:
	<CAC1MbOuKf4iC8PNyLHmeDq4q5DT0z17mvVH+vmiTipH56z68vQ at mail.gmail.com>
Content-Type: text/plain

Dear all,

How can I retrieve only p-value to store it in a file after applying anova()
on some microarray gene expression data set??

For example,

*Suppose my result is:*
*
*
*Analysis of Variance Table*
*
*
*Response: wt*
*          Df Sum Sq Mean Sq F value  Pr(>F)  *
*treat      1 1.2100  1.2100   5.548 0.03361 **
*Residuals 14 3.0534  0.2181                  *
*---*
*Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 *

I want to store only p-value(0.03361) in a file.

Thanks in advance,

Anirban



More information about the Bioconductor mailing list