title: Logical variable in data.table is not truely binary
body: <p>I tried hard to come up with a simple example demonstrating my issue. Unfortunately, I failed. So please apologize. </p>
  
  <p>I am working with data.table 1.9.6 on a very large dataset with more than 100 million rows and nearly 60 columns. After doing several operations I face the following issue with column <code>del</code> which I try to explain giving the following outputs:</p>
  
  <pre><code>&gt; data[, class(del)]
  [1] "logical"
  
  &gt; data[, summary(del)]
     Mode     FALSE    TRUE   NA's
  logical 124763883 2088978      0
  </code></pre>
  
  <p>So far so good, everything is fine. But then I noticed:</p>
  
  <pre><code>&gt; nrow(data[del==TRUE])
  [1] 0
  
  &gt; nrow(data[del==FALSE])
  [1] 126790922
  </code></pre>
  
  <p>Seems that some of the entries are either <code>TRUE</code> nor <code>FALSE</code> but in fact somewhere in between <code>0</code> and <code>1</code>:</p>
  
  <pre><code>&gt; nrow(data[del&lt;0.5])
  [1] 124763883
  
  &gt; nrow(data[del&gt;0.5])
  [1] 2088978
  </code></pre>
  
  <p>But how can that happen? I only assigned <code>TRUE</code> and <code>FALSE</code>'s to this column. Again, I would have loved to produce a little example but it does not work, in a sense that the issue disappears if I select a subset. For example if a select row 47639 (<code>id</code> is unique):</p>
  
  <pre><code>&gt; data[id==47639, list(del)]
      del
  1: TRUE
  </code></pre>
  
  <p><code>del</code> seems to be set to <code>TRUE</code>. So if I <strong>first</strong> select this specific row and then test whether <code>del</code> is <code>TRUE</code> it works:</p>
  
  <pre><code>&gt; data[id==47639][del==TRUE, list(del)]
      del
  1: TRUE
  </code></pre>
  
  <p>But <code>data[del==TRUE][id==47639, list(del)]</code> produces no output.</p>
  
  <pre><code>Empty data.table (0 rows) of 1 col: del
  </code></pre>
  
  <p>[Edit] I have spent a considerable amount of time in reducing the size of my dataset to make a reproduceable example. It now has only 132 rows and 1 column and still the odd behaviour. This is what I get:</p>
  
  <pre><code>data[, summary(del)]
     Mode   FALSE    TRUE    NA's 
  logical     129       3       0 
  &gt; nrow(data[del==TRUE])
  [1] 1
  &gt; nrow(data[del==FALSE])
  [1] 127
  &gt; nrow(data[del&lt;0.5])
  [1] 129
  &gt; nrow(data[del&gt;0.5])
  [1] 3
  </code></pre>
  
  <p>Using <code>dput</code> to post the sample here fails because:</p>
  
  <pre><code>&gt; dput(data)
  structure(list(del = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, 
  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
  FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE)), .Names = "del", class = c("data.table", 
  "data.frame"), row.names = c(NA, -132L), .internal.selfref = &lt;pointer: 0x1914ca8&gt;, index = structure(integer(0), "`__del`" = integer(0)))
  </code></pre>
  
  <p>So <code>dput</code> and <code>dget</code> together produce:</p>
  
  <pre><code>&gt; dput(data, "dt")
  &gt; dget("dt")
  Error in parse(file = file, keep.source = keep.source) : 
    dt:16:62: unexpected '&lt;'
  15: FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE)), .Names = "del", class = c("data.table", 
  16: "data.frame"), row.names = c(NA, -132L), .internal.selfref = &lt;
  </code></pre>
  
  <p>This looks like a bug to me. Of course, I could use the workaround <code>data[(del)]</code> but that means rewriting all my previous code to make it safe. What concerns me most is that I do not know which operation exactly corrupts <code>data</code>.</p>
  
  <p>I could also provide a tiny RData file if that is of any help but I do not know how to post it here correctly.</p>