title: Error in curve(expr = x, from = from, to = to, xlim = xlim, ylab = ylab, : 'expr' did not evaluate to an object of length 'n'
body: <p>I wanted to plot the following piece wise function however I keep getting the error</p>
  <pre><code>a &lt;- function(x) {ifelse(( x &lt; -1), 0, ifelse((-1 &lt; x &amp; x &lt; 2),(x^3 + 1)/9, ifelse((x &gt; 2), 1, NA))) } 
   plot(a, xlim=c(-5, 5), ylim = c(-4, 7), col = &quot;red&quot;) 
   abline(v = 0, h = 0)
  </code></pre>