title: R: debugging "undefined columns selected"
body: <p>When working with R, one of the most common errors is using a non-existent column:</p>
  
  <pre><code>Error in `[.data.frame`(data, , c(id, nbdays, study, methods)) : 
    undefined columns selected
  </code></pre>
  
  <p>For simple code, this is easy to fix, but for complex code and dataframes having hundreds of columns, identifying the offending column can quickly become a nightmare.</p>
  
  <p>Is there a way to figure out which columns are missing?</p>