title: Selecting rows with at least one missing value (NA) in a data.table
body: <p>What is the convenient way to select the rows of several variables in a data table, that have <strong>at least one NA value</strong>. I found a way, but it is not convenient if there are many variables to select from.</p>
  
  <p>Here is the working example:</p>
  
  <pre><code>library(data.table)
  
  # Create a data table 
  DT &lt;- data.table(V1=1:5, V2=LETTERS[1:5])
  
  # Insert some missing values
  DT[c(1,3),V1 := NA]
  DT[c(1,2),V2 := NA]
  
  # Check the output
  print(DT)
  
     V1 V2
  1: NA NA
  2:  2 NA
  3: NA  C
  4:  4  D
  5:  5  E
  
  # Select if there is at least one NA:
  # My solution:
  
  myDT &lt;- DT[is.na(V1) | is.na(V2), ]
  
  # Check output
  print(myDT)
  
     V1 V2
  1: NA NA
  2:  2 NA
  3: NA  C
  </code></pre>
  
  <p>So this solution works but <strong>is not convenient if there are many more variables</strong> (V1, V2, V3, ...). </p>
  
  <p>Is there a better way to do it ?</p>