dear R wizards:  environment-related programming question:

myformula = y ~ a*x^2+b*x+c
d= data.frame( x=rnorm(20), y=rnorm(20) )

cat("\nunconstrained works: \n");
nls( myformula, data=d, start=list(a=1, b=1, c=1), trace= TRUE)

cat("\nconstrained works: \n");
b=1; nls( myformula, data=d, start=list(a=1, c=1), trace= TRUE); rm(b)

cat("\nbut how do I pass a local parameter into my formula? \n");
f = function(c) nls( myformula, data=d, start=list(a=1, b=1), trace= TRUE)

f(c=1);

advice, as always, appreciated.  /iaw

----
Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com)

______________________________________________
R-help@r-project.org mailing list
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