Re: [R] access elements of summary.aov?

2009-10-19 Thread Prof Brian Ripley
It is a 'List of 1', so you want tmp[[1]] which you can access as a 
data frame.  As the help file says


 For a fit with a single stratum the result will be a list of
 ANOVA tables, one for each response (even if there is only one
 response): the tables are of class 'anova' inheriting from class
 'data.frame'.  They have columns 'Df', 'Sum Sq', 'Mean
 Sq', as well as 'F value' and 'Pr(F)' if there are non-zero
 residual degrees of freedom.  There is a row for each term in the
 model, plus one for 'Residuals' if there are any.

and you have a single response so select the only element of the 
list.


On Mon, 19 Oct 2009, Liviu Andronic wrote:


Dear all
How do I access individual elements of a summary.aov object?

data(iris)
AnovaModel.1 - aov(Sepal.Length ~ Species, data=iris)
tmp - summary(AnovaModel.1)
tmp

Df Sum Sq Mean Sq F value Pr(F)
Species   2   63.231.6 119 2e-16 ***
Residuals   147   39.0 0.3
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

str(tmp)

List of 1
$ :Classes 'anova' and 'data.frame':2 obs. of  5 variables:
 ..$ Df : num [1:2] 2 147
 ..$ Sum Sq : num [1:2] 63.2 39
 ..$ Mean Sq: num [1:2] 31.606 0.265
 ..$ F value: num [1:2] 119 NA
 ..$ Pr(F) : num [1:2] 1.67e-31 NA
- attr(*, class)= chr [1:2] summary.aov listof

tmp$1

Error: unexpected numeric constant in tmp$1

tmp$1

NULL

tmp$

NULL

Thank you
Liviu




--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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.


Re: [R] access elements of summary.aov?

2009-10-19 Thread Liviu Andronic
On 10/19/09, Prof Brian Ripley rip...@stats.ox.ac.uk wrote:
 It is a 'List of 1', so you want tmp[[1]] which you can access as a data
 frame.  As the help file says

Thank you. I forgot how to access elements of lists.
Regards
Liviu

__
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.