Having read this question and this link, I already know that model.matrix can help convert data frame with factors into a design matrix.
My question is if you pass this model.matrix into glmnet or cv.glmnet function with the argument standardize set to TRUE, it still scales those dummy variable columns, am I correct ? So it means that glmnet still cannot differentiate the categorical variables from the continuous variables and handle them differently. So how can I make glmnet standardize the non-categorical columns but not the categorical columns ?
glmneta model matrix where only the variable you wish to be standardised are standardised and set the argumentstandardizetoFALSE. – usεr11852 Jul 15 '17 at 12:08caretand define your own cross-validation procedure if you are bothered so you don't usecv.glmnetat all. – usεr11852 Jul 15 '17 at 13:31