I want to select all variables that are not numeric using
select_if of tidyverse.
mydata.dataframe %>% select_if(!is.numeric)
But I have an error message.
What is the correct way to do it please.
is.numeric is a function.
!, by contrast, negates a logical value. Applying
! to a function makes no sense. You need to call the function and negate its result.
In general you’d do the following:
select_if(function (x) ! is.numeric(x))
Or, using the lambda notation of tidyeval:
select_if(~ ! is.numeric(.x))
But R has a function factory to negate the result of a function: