[R] model.tables and NA?

Simon Wotherspoon Simon.Wotherspoon at utas.edu.au
Fri Jan 24 02:00:03 CET 2003

	This might be a minor bug, or it could be that I'm just mis-using the tools

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.


More information about the R-help mailing list