title: How do I remove all integer columns from a dataframe in R with dplyr?
body: <p>I would like to remove all integer columns from my dataframe utilizing dplyr leaving only non-integer numeric columns. I thought I would be able to do like with the below:</p>
  
  <p>Note: I realize I can select the numerics in my example below, but my actual dataset has other variable types in addition to numeric and integer.</p>
  
  <pre><code>library(dplyr)
  mydata &lt;- USArrests
  
  mydata2 &lt;- mydata %&gt;% 
    select(!is.integer)
  </code></pre>
  
  <p>but that gives the error:</p>
  
  <blockquote>
    <p>Error in !is.integer : invalid argument type</p>
  </blockquote>
  
  <pre><code>mydata2 &lt;- mydata %&gt;% 
    select(-is.integer)
  </code></pre>
  
  <p>Errors out with:</p>
  
  <blockquote>
    <p>Error in -x : invalid argument to unary operator</p>
  </blockquote>
  
  <p>The following works, but I'd like to know how to do this in dplyr as well.</p>
  
  <pre><code>mydata_temp &lt;- mydata[, sapply(mydata, function(x) !is.integer(x))]
  mydata_numeric_vars &lt;- mydata_temp %&gt;% 
    select_if(is.numeric)
  </code></pre>
  
  <p>Any suggestions? Seems like this should be fairly straightforward in dplyr but in looking around stack I can't seem to find a similar Q/A for this?</p>