Hello everyone,

I've been struggling with the usage of ellipsis argument for stats::nls
and similar functions. In particular, nls manual indicates this:

...: Additional optional arguments.  None are used at present.

However, "none are used" seems to be slightly misleading. Here's an
example:

data <- data.frame("x" = rnorm(100),
                  "y" = rnorm(100))
fn <- function(y, a) a * y

## This works
nls(y ~ fn(x, a), data = data, start = list("a" = 1))
## This doesn't
nls(y ~ fn(x, a), data = data, start = list("a" = 1), myarg = FALSE)
## But this does
nls(y ~ fn(x, a), data = data, start = list("a" = 1), myarg = rnorm(100))

traceback() indicates that the additional argument is passed to
model.frame.default() but doesn't appear to do anything.

Is this expected behaviour?

Rytis

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to