I need to select all columns that are not numeric. I can select all numeric columns easily using select_if :
mtcars %>% select_if(is.numeric)
What if I want to select non-numeric columns? I tried:
mtcars %>% select_if(!is.numeric)
But I got error message below:
Error in !is.numeric : invalid argument type
Thanks a lot for help!
Best Answer-推荐答案 strong>
You can use purrr 's negate() which is included if you use library(tidyverse) rather than just library(dplyr)
library(tidyverse)
iris %>% select_if(negate(is.numeric))
[dbther] |