R code: "Error in parse unexpected end of input" when using non-linear solver
<p>I am using the non-linear solver (nls) in R, but cannot run my model due to a parser error that I have no idea how to debug. Could someone please offer some advice on how to fix this?</p>

<p>Code:</p>

<pre><code>Bass.nls &lt;- nls( Zt[which(!is.na(Zt))] ~ M * ( ((P+Q)^2 / P) * exp(-(P+Q) * days) ) / (1+(Q/P)*exp(-(P+Q)*days))^2, start = list(M=Z[tInt], P=0.03, Q=0.38), lower = list(Y[tInt], 0,0), upper = list(2e10, 1,1), algorithm = "port", trace = TRUE)
</code></pre>

<p>Error:</p>

<blockquote>
  <p>Error in parse(text = x, keep.source = FALSE) : 
    :2:0: unexpected end of input
  1: ~ </p>
</blockquote>