[R] na.action in model.tables and TukeyHSD
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Feb 28 15:13:02 CET 2003
ndata <- na.omit(led1t7sts) and work with ndata.
Why is that difficult?
On Fri, 28 Feb 2003, CG Pettersson wrote:
> In 27/2, I got the following answer from Prof. Ripley: (The question is at the bottom)
> >This ia already fixed in R-devel. The answer is the same: don't use
> >na.omit implicitly: use it explicitly.
> I feel rather stupid for the moment, as I don´t understand an answer that looks very simple.
> What´s the code to do the trick using na.omit explicitly? (Preferably starting with my code in the question)
> I can´t get it to work, so my tries are not worth printing here...
> 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
> > trial with only na:s in it).
> > Thanks
> > /CG
> > CG Pettersson
> > cg.pettersson at evp.slu.se
> CG Pettersson
> cg.pettersson at evp.slu.se
> R-help at stat.math.ethz.ch mailing list
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help