title: Use of ifelse after pipe operator
body: <p>I wish to apply one of two functions to elements of vector. Choice of which function to use is made based on vector's values.</p>
  
  <p>To be specific: imagine you want to convert years coded with two digits (like '07' for '2007' and '85' for '1985') to four digits, assuming that all the dates are between 1919 and 2018. </p>
  
  <p>So, you have to add 1900 to numbers larger than 18 and add 2000 to other numbers.</p>
  
  <p>Now I want to do that with <code>%&gt;%</code> operator (to be able to use it inside <code>mutate</code> statment in future).</p>
  
  <p>This one:</p>
  
  <pre><code>c(18,20,21,15) %&gt;% ifelse(.&gt;18, .+1900, .+2000)
  </code></pre>
  
  <p>produces an error:</p>
  
  <pre><code>Error in ifelse(., . &gt; 18, . + 1900, . + 2000) : unused argument (. + 2000)
  </code></pre>
  
  <p>I even understand why: <code>%&gt;%</code> forces vector <code>c(18,20,21,15)</code> to be used as first argument of <code>ifelse</code>.</p>
  
  <p>I have a workaround using anonymous function:</p>
  
  <pre><code>c(18,20,21,15) %&gt;% (function(x) ifelse(x&gt;18, x+1900, x+2000))
  [1] 2018 1920 1921 2015
  </code></pre>
  
  <p>Can you suggest anything to avoid them (them = anonymous functions)?</p>