I've been using R and the caret
package since a while. The caret
package provides a function to reduce the number of variables - nearZeroVar()
wherein variables that have close to zero variance are returned and one can remove them from the dataframe
Caret
also provides another function dummyVars
that converts factors to dummy variables.
Now my question is - what should the order of using the two be? Should the features with near zero variance be thrown out and then converted to dummies or should it be the other way around? I have a feeling that the order matters because in some cases dummy variables might have a lot of zeros but still be important.