you could use ldply from the plyr package: p = ldply(q,function(x){x$P})
Without you data I can't confirm that works, but something like that should do it On Wed, May 27, 2009 at 9:23 AM, Imri <bisr...@agri.huji.ac.il> wrote: > > Thanks for the answer!!! > I Know how to extract the Pr(>F) value from single ANOVA table, but I have a > list of many ANOVA tables recived by : > a<-function(x)(aov(MPH~x)) > q<-apply(assoc[,18:20],2,a) # just for example, I have more than 3 > factors(x) > >> print(q) > $X11_20502 > Df Sum Sq Mean Sq F value Pr(>F) > x 3 369.9 123.3 6.475 0.0002547 *** > Residuals 635 12093.2 19.0 > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > 246 observations deleted due to missingness > > $X11_21067 > Df Sum Sq Mean Sq F value Pr(>F) > x 1 26.7 26.7 1.3662 0.2429 > Residuals 637 12436.4 19.5 > 246 observations deleted due to missingness > > $X11_10419 > Df Sum Sq Mean Sq F value Pr(>F) > x 3 527.8 175.9 9.361 4.621e-06 *** > Residuals 635 11935.3 18.8 > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > 246 observations deleted due to missingness > >> summary(q) > Length Class Mode > X11_20502 1 summary.aov list > X11_21067 1 summary.aov list > X11_10419 1 summary.aov list > How can I extract all the Pr(>F) values from q (not one by one)? > > Thanks > Imri > > > > Mike Lawrence wrote: >> >> #create some data >> y=rnorm(20) >> x=factor(rep(c('A','B'),each=10)) >> >> #run the anova >> my_aov = aov(y~x) >> >> #summarize the anova >> my_aov_summary = summary(my_aov) >> >> #show the anova summary >> print(my_aov_summary) >> >> #lets see what's in the summary object >> str(my_aov_summary) >> >> #looks like it's a list with 1 element which >> #in turn is a data frame with columns. >> #The "Pr(>F)" column looks like what we want >> my_aov_summary[[1]]$P >> >> #yup, that's it. Grab the first value >> p = my_aov_summary[[1]]$P[1] >> >> >> On Wed, May 27, 2009 at 7:11 AM, Imri <bisr...@agri.huji.ac.il> wrote: >>> >>> Hi all - >>> I'm trying to do multiple one-way ANOVA tests of different factors on the >>> same variable. As a result I have a list with all the ANOVA tables, for >>> exemple: >>> >>> $X11_20502 >>> Analysis of Variance Table >>> >>> Response: MPH >>> Df Sum Sq Mean Sq F value Pr(>F) >>> x 3 369.9 123.3 6.475 0.0002547 *** >>> Residuals 635 12093.2 19.0 >>> --- >>> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >>> >>> $X11_21067 >>> Analysis of Variance Table >>> >>> Response: MPH >>> Df Sum Sq Mean Sq F value Pr(>F) >>> x 1 26.7 26.7 1.3662 0.2429 >>> Residuals 637 12436.4 19.5 >>> >>> $X11_10419 >>> Analysis of Variance Table >>> >>> Response: MPH >>> Df Sum Sq Mean Sq F value Pr(>F) >>> x 3 527.8 175.9 9.361 4.621e-06 *** >>> Residuals 635 11935.3 18.8 >>> --- >>> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >>> >>> My question is how can I extract from this list, just the Pr(>F) values >>> for >>> each x ? >>> -- >>> View this message in context: >>> http://www.nabble.com/Multiple-ANOVA-tests-tp23739615p23739615.html >>> Sent from the R help mailing list archive at Nabble.com. >>> >>> ______________________________________________ >>> R-help@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. >>> >> >> >> >> -- >> Mike Lawrence >> Graduate Student >> Department of Psychology >> Dalhousie University >> >> Looking to arrange a meeting? Check my public calendar: >> http://tr.im/mikes_public_calendar >> >> ~ Certainty is folly... I think. ~ >> >> ______________________________________________ >> R-help@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. >> >> > > -- > View this message in context: > http://www.nabble.com/Multiple-ANOVA-tests-tp23739615p23741437.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University Looking to arrange a meeting? Check my public calendar: http://tr.im/mikes_public_calendar ~ Certainty is folly... I think. ~ ______________________________________________ R-help@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.