[R] na.action in model.tables and TukeyHSD

CG Pettersson cg.pettersson at evp.slu.se
Wed Feb 26 13:56:02 CET 2003


Hello everybody!

I use R 1.6.2 in Windows, and have a problem controlling the na.action.

In a dataset with twelve trials, one of the trials lack any readings of the variable "STS.SH" (standing power at harvest)

Fitting an aov() object with the call:
led1t7sts.aov <- aov(STS.SH ~ Trial/Block + Treatment + Treatment:Trial, data = led1t7, na.action=na.exclude)  
seems to work as it produces an object with 10 df for the factor "Trial".

But when I use model.tables or TukeyHSD on the object I get this:
> model.tables(led1t7sts.aov, "means")
Error in replications(paste("~", paste(names(tables), collapse = "+")),  : 
        na.action must be a function

I have tried to use "na.action=na.exclude" inside the model.tables call as well, without any bettering.

I can naturally cope with the problem by taking the whole trial away from the dataset, but it doesn´t feel very sophisticated...;-)
(Prof. Ripley answered a similar question from me two weeks ago. The answer was good but didn´t work as the reason of the error was the same as this time: a whole 
trial with only na:s in it).

Thanks
/CG
CG Pettersson
cg.pettersson at evp.slu.se




More information about the R-help mailing list