title: Filtering a csv in R: unused argument (.SDcols = variable)
body: <p>I am working with <code>R version 3.2.1</code> on <code>OS X Yosemite (Version 10.10.4)</code>.</p>
  
  <p>Read a CSV file using:</p>
  
  <pre><code>&gt; train = read.csv("~/Downloads/train.csv", header = TRUE)
  </code></pre>
  
  <p>Then initialized a variable:</p>
  
  <pre><code>&gt; cat_var &lt;- names(train)[which(sapply(train, is.character))]
  &gt; cat_var &lt;- c(cat_var, 'BedroomAbvGr', 'HalfBath', ' KitchenAbvGr','BsmtFullBath', 'BsmtHalfBath', 'MSSubClass')
  </code></pre>
  
  <p>Now I want to find the total null values in the <code>cat_var</code> columns, but getting the following error:</p>
  
  <pre><code>&gt; colSums(sapply(train[,.SD, .SDcols=cat_var], is.na))
  Error in `[.data.frame`(train, , .SD, .SDcols = cat_var) : 
    unused argument (.SDcols = cat_var)
  </code></pre>