title: When trying to replace values, "missing values are not allowed in subscripted assignments of data frames"
body: <p>I have a table that has two columns: whether you were sick (H01) and the number of days sick (H03). However, the number of days sick is NA if H01 == false, and I would like to set it to 0. When I do this:</p>
  
  <pre><code>test &lt;- pe94.person[pe94.person$H01 == 12,]
  test$H03 &lt;- 0
  </code></pre>
  
  <p>It works fine. However, I'd like to replace the values in the original dataframe. This, however, fails:</p>
  
  <pre><code>pe94.person[pe94.person$H01 == 12,]$H03 &lt;- 0
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code>&gt; pe94.person[pe94.person$H01 == 12,]$H03 &lt;- 0
  Error in `[&lt;-.data.frame`(`*tmp*`, pe94.person$H01 == 12, , value = list( : 
    missing values are not allowed in subscripted assignments of data frames
  </code></pre>
  
  <p>Any idea why this is? For what it's worth, here's a frequency table:</p>
  
  <pre><code>&gt; table(pe94.person[pe94.person$H01 == 12,]$H03)
  
   2  3  5 28 
   3  1  1  1 
  </code></pre>