[R] matching of arguments in ...?
David Firth
d.firth at warwick.ac.uk
Wed Nov 5 14:56:40 CET 2003
I am puzzled by this (with R --vanilla):
> test <- function(formula, ...) lm(formula, ...)
> test(1:4 ~ 1, offset=rep(1,4))
Error in eval(expr, envir, enclos) : ..1 used in an incorrect
context, no ... to look in
> test(1:4 ~ 1, weights=rep(1,4))
Error in eval(expr, envir, enclos) : ..1 used in an incorrect
context, no ... to look in
> test(1:4 ~ 1, x=TRUE)
Call:
lm(formula = formula, x = TRUE)
Coefficients:
(Intercept)
2.5
Some arguments (such as x) seem to pass willingly through ..., while
others (such as offset and weights) do not. Same thing happens with
glm. I haven't experimented more widely.
Can some kind soul offer an explanation?
Thanks,
David
> version
_
platform powerpc-apple-darwin6.7.5
arch powerpc
os darwin6.7.5
system powerpc, darwin6.7.5
status
major 1
minor 8.0
year 2003
month 10
day 08
language R
More information about the R-help
mailing list