glmnet
is not a drop-in replacement for stats::glm
— it has its own argument structure (in particular, it does not take a data
argument, as the error above indicates). You should make sure you’ve read the documentation, and if that doesn’t totally make sense, you’ll probably want to consult the main vignette included with the glmnet
package.