[R] Error TukeyHSD

Prof Brian Ripley
Fri, 27 Aug 2004 06:50:59 -0000

You are trying to apply TukeyHSD to a linear regression.  I think you want
`diet' to be a factor, but it is not.  (The warning message told you
that.) The model needs to be

coag.mod <- aov(time ~ factor(diet), data=coag)

Function aov happily accepts continuous covariates as it can also do
ANCOVA.

On Thu, 26 Aug 2004, T. Murlidharan Nair wrote:

> I am running the following code on the coagulation data and I am getting
> an error. Please let me know
> if I am missing anything from my code.
>
> coag<- matrix( scan("//Samba3/nair/R/blood.dat",
sep=","), 24, 3,
> byrow=TRUE)
> colnames(coag) <- c("time","diet","order")
> coag <- as.data.frame(coag)
> oneway.test(time ~  diet, data=coag, var.eq=TRUE)
> coag.mod <- aov(time ~ diet, data=coag)
> options(scipen=5)
> options(digits=5)
> TukeyHSD( coag.mod )
>
>
> I get the following error when I run the above code
> Read 72 items
> Error in rep.int(n, length(means)) : Unimplemented feature in rep
> In addition: Warning message:
> non-factors ignored: diet in: replications(paste("~",
> paste(names(tables), collapse = "+")),

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