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

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Feb 27 19:34:02 CET 2003


This ia already fixed in R-devel.  The answer is the same: don't use 
na.omit implicitly: use it explicitly.

On Wed, 26 Feb 2003, CG Pettersson wrote:

> 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
> 
> ______________________________________________
> 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




More information about the R-help mailing list