It's not a bug. It's a case that is not supported, as the error message
says. That's because model.tables.aov is intended only for balanced
designs, and you have unbalanced that one. (And look at what the help
page says too.)
Try
npk.aov <- aov(yield ~ block + N*P*K, na.omit(npk))
and you will get an unbalance warning.
If you want to work out to to implement the unsupported cases, please take
a look at the R startup message, and join the contributors.
On Fri, 24 Jan 2003, Simon Wotherspoon wrote:
> Hi,
> This might be a minor bug, or it could be that I'm just mis-using the
tools
> (again).
>
> If you modify the example for model.tables to introduce an NA,
>
> N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
> P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
> K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
> yield <- c(49.5,62.8,46.8,57.0,59.8,58.5,55.5,56.0,62.8,55.8,69.5,
> 55.0, 62.0,48.8,45.5,44.2,52.0,51.5,49.8,48.8,57.2,59.0,53.2,NA) #
> My change
>
> npk <- data.frame(block=gl(6,4), N=factor(N), P=factor(P),
> K=factor(K), yield=yield)
> npk.aov <- aov(yield ~ block + N*P*K, npk)
> model.tables(npk.aov, "means", se=TRUE)
>
>
> you get the error
>
> > model.tables(npk.aov, "means", se=TRUE)
> Error in replications(paste("~", paste(names(tables), collapse =
"+")), :
> na.action must be a function
>
> and I can't figure how to tell model.tables which na.action to use in a
way
> it likes.
>
> Simon.
> ---
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
Brian D. Ripley, ripley at 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, UK Fax: +44 1865 272595