In my project, I want to extract all the columns except numeric from my R data frame, as this question I used the same method and just put a not gate into is.numeric() R function but it is not working
This gives all the numaric data,
x<-iris %>% dplyr::select(where(is.numeric))
But this does not work as expected,
x<-iris %>% dplyr::select(where(!is.numeric))
Note: Finally the output data frame should only contain the species column in the iris dataset
purrrpackage fromtidyverseserves exactly what you want bypurrr::keepandpurrr::discardby these piece of code, you set a logical test in
keepfunction and only the columns which passed the test stays.to reverse that operation and achieve to your wish, you can use
discardfrompurrralso;you can think
discardaskeepbut with!is.numericor alternatively by
dplyr