I am trying to split a data set into parts that have factor variables and non-factor variables.
I want to do something like:
This part works:
factorCols <- sapply(df1, is.factor) factorDf <- df1[,factorCols]
This part will not work:
nonFactorCols <- sapply(df1, !is.factor)
due to this error:
Error in !is.factor : invalid argument type
Is there a proper way to do this?
source share