title: Error with curve( ): 'expr' did not evaluate to an object of length 'n'
body: <p>I have a function that has a vector in the numerator and the sum of the vector in the denominator.  So each component is one component of the vector divided by a function that depends on the sum of the components.  I want to plot a curve representing the function in the first component holding fixed the other components.  Why doesn't this code work?</p>
  
  <pre><code>y &lt;- vector(length=2)
  y0 &lt;- c(1,2)
  f &lt;- function(y) y/(1+sum(y))
  g &lt;- function(x) f(c(x,y0[2]))[1]
  curve(g, 0, 2)
  </code></pre>
  
  <p>Both f and g evaluate as expected at numerical values, but the curve function gives the error:</p>
  
  <pre><code>Error in curve(g, 0, 2) : 
    'expr' did not evaluate to an object of length 'n'
  </code></pre>
  
  <p>I tried Vectorizing g with no success.  Appreciate any help.</p>