[R] evaluating expression within nls()
Timur Elzhov
Timur.Elzhov at jinr.ru
Wed Oct 29 16:54:05 CET 2003
Dear R experts,
I'd like to fit data with weighted function fcn(data, p1, p2). At
first I used the standard form:
nls(~ fcn(data, p1, p2),
start = list(p1 = p01, p2 = p02),
data = data)
Then, I decided to change fcn() that it would be able to accept expression
as an additional parameter,
nls(~ fcn(data, expr, p1, p2), ...)
# ('expr' is defined just before 'nls' calling)
Error in eval(expr, envir, enclos) : Object "expr" not found
Yes, in help(nls) is pointed, that
Arguments:
data: an optional data frame in which to evaluate the variables in
`formula'
But, I'd like 'nls' to see my expression 'expr'... :-/ How can I do that?
Thank you!
--
WBR,
Timur.
More information about the R-help
mailing list