Hi:

On Wed, Sep 29, 2010 at 5:56 AM, peter dalgaard <pdalgd@gmail.com> wrote:

>
> On Sep 29, 2010, at 14:25 , Dennis Murphy wrote:
>
> >
> > test.summary[[1]][, 5][1]
> >
> > You mean that wasn't obvious?   :)
>
> Worse, it doesn't actually work...
>
> > test.summary <- summary(npk.aovE)
> > test.summary[[1]][, 5]
> Error in `[.default`(test.summary[[1]], , 5) :
>  incorrect number of dimensions
> > test.summary$"Error: block"[[1]][, 5]
> [1] 0.5252361        NA
> > test.summary[[1]][[1]][, 5]
> [1] 0.5252361        NA
>
> I.e., you need an extra list extraction operator. The data structure goes
>
> List of 2
>  $ Error: block :List of 1
>  ..$ :Classes ‘anova’ and 'data.frame':        2 obs. of  5 variables:
>  .. ..$ Df     : num [1:2] 1 4
>  .. ..$ Sum Sq : num [1:2] 37 306
> ...
>  and the intermediate list has class ("summary.aov","listof"). I believe
> the point is that you can have a matrix LHS and get a table for each of its
> columns.
>

I presume we're using about the npk data in the MASS package.

> library(MASS)
> npk.aov <- aov(yield ~ block + N*P*K, data = npk)
> npk.aovE <- summary(npk.aov)
> str(npk.aovE)
List of 1
 $ :Classes ‘anova’ and 'data.frame':   8 obs. of  5 variables:
  ..$ Df     : num [1:8] 5 1 1 1 1 1 1 12
  ..$ Sum Sq : num [1:8] 343.3 189.3 8.4 95.2 21.3 ...
  ..$ Mean Sq: num [1:8] 68.7 189.3 8.4 95.2 21.3 ...
  ..$ F value: num [1:8] 4.447 12.259 0.544 6.166 1.378 ...
  ..$ Pr(>F) : num [1:8] 0.01594 0.00437 0.4749 0.0288 0.26317 ...
 - attr(*, "class")= chr [1:2] "summary.aov" "listof"
> npk.aovE[[1]][, 5]
[1] 0.015938790 0.004371812 0.474904093 0.028795054 0.263165283 0.168647879
[7] 0.862752086          NA
> npk.aovE[[1]][, 5][1]
[1] 0.01593879
> npk.aovE[[1]][, 'Pr(>F)']
[1] 0.015938790 0.004371812 0.474904093 0.028795054 0.263165283 0.168647879
[7] 0.862752086          NA
> npk.aovE[[1]][, 'Pr(>F)'][1]
[1] 0.01593879

What am I missing?

Regards,
Dennis

--
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes@cbs.dk  Priv: PDalgd@gmail.com
>
>

	[[alternative HTML version deleted]]

