title: In R, is there a way to handle NA in an integer column of a data.frame so that NA values are not included when subsetting?
body: <p>I have a data.frame like this:</p>
  
  <pre><code>(t=structure(list(count = c(NA, 2, NA, NA, NA, 8, NA, NA, NA)), .Names = "count", row.names = c(NA,-9L), class = "data.frame"))
    count
  1    NA
  2     2
  3    NA
  4    NA
  5    NA
  6     8
  7    NA
  8    NA
  9    NA
  </code></pre>
  
  <p>It is great that R has the NA value but sometimes it bites me. I often forget about it and try to do subsetting like this</p>
  
  <pre><code>&gt; t[t$count&gt;=1,]
  [1] NA  2 NA NA NA  8 NA NA NA
  </code></pre>
  
  <p>And the output includes all NA rows. (which I don't like)</p>
  
  <p>After an hour of bug searching  I change the code to this and that is what I want (<strong>imagine large dataframe</strong> a lots of non-NA resuls and only few "well-hidden" NAs):</p>
  
  <pre><code>&gt; t[t$count&gt;=1&amp;!is.na(t$count),]
  [1] 2 8
  </code></pre>
  
  <p>1.
  Is there a feature of the "as.integer" function so that I could do something like this:    </p>
  
  <blockquote>
    <p>t[as.integer.EXCLUDE.NA(t$count)>=1,]</p>
  </blockquote>
  
  <p>I would want to use such feature in other as.xxxx functions as well. Basically force R to stop think like a statistician and treat NA differently (e.g., like NULL (I am not sure NULL would solve my issue) (this did not work: t$count[3]&lt;-NULL for some reason)</p>
  
  <p>2.
  or how would I run</p>
  
  <pre><code>transform(t, replace all NAs from count columns with 0)
  </code></pre>
  
  <p>or even better</p>
  
  <pre><code>transform(t, replace all NA from all numeric columns with 0 in t)
  </code></pre>
  
  <p>3.
  any generic comments on making R forget about NAs are welcomed?</p>