title: Drop columns in a data.frame with conditions R
body: <p>I am trying to be lazier than ever with R and I was wondering to know if there is a chance to drop columns from a data.frame by using a condition.</p>
  
  <p>For instance, let's say my data.frame has 50 columns.</p>
  
  <p>I want to drop all the columns that share each other </p>
  
  <pre><code>mean(mydata$coli)... = mean(mydata$coln) = 0
  </code></pre>
  
  <p>How would you write this code in order to drop them all at once? Because I use to drop columns with </p>
  
  <pre><code>mydata2 &lt;- subset(mydata, select = c(vari, ..., varn))
  </code></pre>
  
  <p>Obviously not interesting because of the need of manual data checking.</p>
  
  <p>Thank you all! </p>