[R] dropterm in a function

Göran Broström gb at stat.umu.se
Fri Oct 4 21:00:18 CEST 2002


On Fri, 4 Oct 2002, Thomas Lumley wrote:

> On Fri, 4 Oct 2002, [iso-8859-1] Göran Broström wrote:
>
> >
> > I'm trying to use 'dropterm' (from MASS) in a function along the lines
> >
> > run <- function(dat){
> >   fit <- (something)(Y ~ (something), data = dat)
> >   lr <- dropterm(fit, test = "Chisq")
> >   return(fit, lr)
> > }
> >
> > but running 'run' I get (those scoping rules again...?)
> >
> > Error in terms.formula(formula, special, data = data) :
> >         Object "dat" not found
> >
> > This works fine at the command line. Can I send 'dat' to 'dropterm'
> > somehow, or what should I do?
> >
>
> What is "something"? If "something" is lm or glm this works for me. I
> would expect it not to work for lme().

It is 'coxph'. So I shouldn't expect it to work? A pity, because it is a
nice feature. Thanks,

Göran


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list