[R] Doubt about aov and lm function... bug?

William Dunlap wdunlap at tibco.com
Thu Apr 9 00:08:46 CEST 2009


I'm also suspicious of code using parse to construct
expressions.  However this problem arose because the
terms class is a subclass of the formula class and
AlgDesign defines a model.matrix method for the formula
class but not for the terms class.  Hence
  model.matrix(terms(...))
invokes model.matrix.formula, which causes the problem
because AlgDesign::model.matrix.formula isn't general enough to
handle a terms object.

If AlgDesign had a model.matrix.terms function that
called model.matrix.default or was a copy of
model.matrix.default then the problem would go away.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com 

>> library(AlgDesign)
> 
>> aov(Sepal.Length ~ Species, data=iris)
> 
> Error in parse(text = x) :
>   unexpected symbol in "Sepal(Sepal.Length+Species)Length"




More information about the R-help mailing list