[R] dropterm in a function

Göran Broström gb at stat.umu.se
Fri Oct 4 12:35:03 CEST 2002

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?

Thankful for any suggestion, including reading certain books!


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