glmnet training throws error on x,y dataframe arguments: am I using it wrong?
问题 I'm trying to learn a penalized logistic regression method with glmnet. I'm trying to predict if a car from the mtcars example data will have an automatic transmission or manual. I think my code is pretty straightforward, but I seem to be getting an error: This first block simply splits mtcars into an 80% train set and a 20% test set library(glmnet) attach(mtcars) smp_size <- floor(0.8 * nrow(mtcars)) set.seed(123) train_ind <- sample(seq_len(nrow(mtcars)), size=smp_size) train <- mtcars