title: `as.na` function
body: <p>In R, almost every <code>is.*</code> function I can think of has a corresponding <code>as.*</code>. There is a <code>is.na</code> but no <code>as.na</code>. Why not and how would you implement one if such function makes sense?</p>
  
  <p>I have a vector <code>x</code> that can be <code>logical</code>, <code>character</code>, <code>integer</code>, <code>numeric</code>  or <code>complex</code> and I want to convert it to a vector of same class and length, but filled with the appropriate: <code>NA</code>, <code>NA_character_</code>, <code>NA_integer_</code>, <code>NA_real_</code>, or <code>NA_complex_</code>.</p>
  
  <p>My current version:</p>
  
  <pre><code>as.na &lt;- function(x) {x[] &lt;- NA; x}
  </code></pre>