title: Why does is.na() change its argument?
body: <p>I just discovered the following behaviour of the <code>is.na()</code> function which I don't understand:</p>
  
  <pre><code>df &lt;- data.frame(a = 5:1, b = "text")
  df
  ##   a    b
  ## 1 5 text
  ## 2 4 text
  ## 3 3 text
  ## 4 2 text
  ## 5 1 text
  is.na(df)
  ##          a     b
  ## [1,] FALSE FALSE
  ## [2,] FALSE FALSE
  ## [3,] FALSE FALSE
  ## [4,] FALSE FALSE
  ## [5,] FALSE FALSE
  is.na(df) &lt;- "0"
  df
  ##   a    b  0
  ## 1 5 text NA
  ## 2 4 text NA
  ## 3 3 text NA
  ## 4 2 text NA
  ## 5 1 text NA
  </code></pre>
  
  <p><strong>My question</strong><br>
  Why does <code>is.na()</code> change its argument (and in this case adds an extra column to the data frame)? In this case its behaviour seems extra puzzling (or at least unexpected) because the result of the query is <code>FALSE</code> for all instances. </p>
  
  <p><strong>NB</strong><BR>
  This question is not about subsetting and changing the <code>NA</code> values in a data frame - I know how to do that (<code>df[is.na(df)] &lt;- "0"</code>). This question is about the behaviour of the <code>is.na</code> function! Why is an assignment to a <code>is.something</code> function changing the argument itself - this is unexpected.</p>