Skip to content
Prev 81678 / 398502 Next

anova.gls from nlme on multiple arguments within a function fails

The error is in anova.gls(): traceback() would have told you that was 
involved.  It ends

do.call("anova.lme", as.list(match.call()[-1]))

and that call needs to be evaluated in the parent, not in the body of 
anova.lme.  Several similar errors (e.g. in the update methods) in package 
nlme have been corrected over the years.

Replacing anova() by anova.lme() in dummy() works.

If you want to do this sort of thing more generally (e.g. messing with 
the contents of '...'), the elegant way is

Call <- match.call()
Call[[1]] <- as.name("anova.lme")
eval.parent(Call)

and that works here.

Since at some later point substitute() is used to find the arguments, here 
you don't want to use do.call() with the evaluated arguments, which is the 
way it is intended to be used.  Similarly, anova.lme(object, ...) is not 
what you want.
On Sun, 27 Nov 2005, Spencer Graves wrote:

            
It actually chokes on both.