title: Why does data.table, setting "with" = F, output a data.table when j is a single column?
body: <p>Let's say I have data table dt. </p>
  
  <pre><code>dt = as.data.table(c(0,1,2,3))
  </code></pre>
  
  <p>I'd like to know why the behavior of dt differs in the following two lines of code.</p>
  
  <pre><code>dt[,V1]
  
  dt[,"V1",with=F]
  </code></pre>
  
  <p>Specifically, the first line produces a numeric vector while the second line produces a data.table. </p>
  
  <p>I'd like to build a function that would allow me to retrieve single columns dynamically by passing a string (thus with=F) and use that output in certain other functions. As it is now, the behavior in the latter case can cause an error in some functions, such as ecdf and hist, which don't accept a data.frame or data.table.</p>
  
  <p>Here's a workaround I've made.</p>
  
  <pre><code>as.data.frame(dt[,"V1",with=F])[,1]
  </code></pre>
  
  <p>This returns the expected output: a vector which plays nicely with ecdf and hist. It's just a bit messy. Is there any reason why the behavior in <code>dt[,"V1",with=F]</code> differs from <code>dt[,V1]</code>?</p>