title: How to select_if in dplyr, where the logical condition is negated
body: <p>I want to select all numeric columns from a dataframe, and then to select all the non-numeric columns. An obvious way to do this is the following :-</p>
  <pre><code>mtcars %&gt;%
      select_if(is.numeric) %&gt;%
      head()
  </code></pre>
  <p>This works exactly as I expect.</p>
  <pre><code>mtcars %&gt;%
      select_if(!is.numeric) %&gt;%
      head()
  </code></pre>
  <p>This doesn't, and produces the error message <strong>Error in !is.numeric : invalid argument type</strong></p>
  <p>Looking at another way to do the same thing :-</p>
  <pre><code>mtcars %&gt;%
      select_if(sapply(., is.numeric)) %&gt;%
      head()
  </code></pre>
  <p>works perfectly, but</p>
  <pre><code>mtcars %&gt;%
      select_if(sapply(., !is.numeric)) %&gt;%
      head()
  </code></pre>
  <p>fails with the same error message. (purrr::keep behaves exactly the same way).</p>
  <p>In both cases using <strong>-</strong> to drop the undesired columns fails too, with the same error as above for the is.numeric version, and this error message for the sapply version <strong>Error: Can't convert an integer vector to function</strong>.</p>
  <p>The help page for is.numeric says</p>
  <blockquote>
  <p>is.numeric is an internal generic primitive function: you can write methods to handle specific classes of objects, see InternalMethods. ... Methods for is.numeric should only return true if the base type of the class is double or integer and values can reasonably be regarded as numeric (e.g., arithmetic on them makes sense, and comparison should be done via the base type).</p>
  </blockquote>
  <p>The help page for ! says</p>
  <blockquote>
  <p>Value</p>
  <p>For !, a logical or raw vector(for raw x) of the same length as x: names, dims and dimnames are copied from x, and all other attributes (including class) if no coercion is done.</p>
  </blockquote>
  <p>Looking at the useful question <a href="https://stackoverflow.com/questions/30153768/negation-in-a-dplyr-pipeline">Negation <code>!</code> in a dplyr pipeline <code>%&gt;%</code></a> I can see some of the reasons why this doesn't work, but neither of the solutions suggested there works.</p>
  <pre><code>mtcars %&gt;%
      select_if(not(is.numeric())) %&gt;%
      head()
  </code></pre>
  <p>gives the reasonable error  <strong>Error in is.numeric() : 0 arguments passed to 'is.numeric' which requires 1</strong>.</p>
  <pre><code>mtcars %&gt;%
      select_if(not(is.numeric(.))) %&gt;%
      head()
  </code></pre>
  <p>Fails with this error :-
  <strong>Error in tbl_if_vars(.tbl, .predicate, caller_env(), .include_group_vars = TRUE) :  length(.p) == length(tibble_vars) is not TRUE</strong>.</p>
  <p>This behaviour definitely violates the principle of least surprise. It's not of great consequence to me now, but it suggests I am failing to understand some more fundamental point.</p>
  <p>Any thoughts?</p>