title: Why does ifelse() return single-value output?
body: <p>Those two functions <em>should</em> give similar results, don't they?</p>
  
  <pre><code>f1 &lt;- function(x, y) {
     if (missing(y)) {
        out &lt;- x
     } else {
        out &lt;- c(x, y)
     }
     return(out)
  }
  
  f2 &lt;- function(x, y) ifelse(missing(y), x, c(x, y))
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>&gt; f1(1, 2)
  [1] 1 2
  &gt; f2(1, 2)
  [1] 1
  </code></pre>