[R] Doubt about aov and lm function... bug?
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Apr 8 23:05:52 CEST 2009
Jose Claudio Faria wrote:
> # a) aov
>> av <- aov(Sepal.Length ~ Species, data=iris)
>
> Error in parse(text = x) :
> unexpected symbol in "Sepal(Sepal.Length+Species)Length"
>
>> traceback()
> 13: parse(text = x)
> 12: eval(parse(text = x)[[1]])
> 11: formula(eval(parse(text = x)[[1]]))
> 10: formula.character(object, env = baseenv())
> 9: formula(object, env = baseenv())
> 8: as.formula(frml)
> 7: expand.formula(frml, colnames(data))
> 6: model.matrix.formula(mt, mf, contrasts)
Er, I have
> getAnywhere(model.matrix.formula)
no object named 'model.matrix.formula' was found
> methods(model.matrix)
[1] model.matrix.default model.matrix.lm
Where did your model.matrix.formula come from???
-p
> 5: model.matrix(mt, mf, contrasts)
> 4: lm(formula = Sepal.Length ~ Species, data = iris, singular.ok = TRUE)
> 3: eval(expr, envir, enclos)
> 2: eval(lmcall, parent.frame())
> 1: aov(Sepal.Length ~ Species, data = iris)
>
> # b) lm
>> lm1 <- lm(Sepal.Length ~ Sepal.Width, data=iris)
>
> Error in parse(text = x) :
> unexpected symbol in "Sepal(Sepal.Length+Sepal.Width)Length"
>
>> traceback()
> 10: parse(text = x)
> 9: eval(parse(text = x)[[1]])
> 8: formula(eval(parse(text = x)[[1]]))
> 7: formula.character(object, env = baseenv())
> 6: formula(object, env = baseenv())
> 5: as.formula(frml)
> 4: expand.formula(frml, colnames(data))
> 3: model.matrix.formula(mt, mf, contrasts)
> 2: model.matrix(mt, mf, contrasts)
> 1: lm(Sepal.Length ~ Sepal.Width, data = iris)
>
> HTH,
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list