title: How to pass a long list of parameters to `nls` function in R
body: <p>The <code>nls</code> function works normally like the following:</p>
  
  <pre><code> x &lt;- 1:10
   y &lt;- 2*x + 3                            # perfect fit
   yeps &lt;- y + rnorm(length(y), sd = 0.01) # added noise
   nls(yeps ~ a + b*x, start = list(a = 0.12345, b = 0.54321))#
  </code></pre>
  
  <p>Because the model I use have a lot of parameters or I don't know beforehand what will be included in the parameter list, I want something like following</p>
  
  <pre><code>tmp &lt;- function(x,p) { p["a"]+p["b"]*x }
  p0 &lt;- c(a = 0.12345, b = 0.54321)
  nls(yeps ~ tmp(x,p), start = list(p=p0))
  </code></pre>
  
  <p>Does anyone know how to modify the <code>nls</code> function so that it can accept a parameter vector argument in the formula instead of many seperate parameters?</p>