[Rd] lm, weights and ...

hadley wickham h.wickham at gmail.com
Sun Sep 3 17:46:02 CEST 2006

> lm2 <- function(...) lm(...)
> lm2(mpg ~ wt, data=mtcars)

lm(formula = ..1, data = ..2)

(Intercept)           wt
     37.285       -5.344

> lm2(mpg ~ wt, weights=cyl, data=mtcars)
Error in eval(expr, envir, enclos) : ..2 used in an incorrect context,
no ... to look in

Can anyone explain why this is happening?  (Obviously this is a
manufactured example, but it crops up in ggplot when you want to
provide a function to perform smoothing)



More information about the R-devel mailing list