9
It is my understanding that glmnet takes matrices where each column is an explanatory variable.
I have a dataframe with ~10 explanatory variables (some of which are factors)
How could I take a formula such as y~(x1*x2*x3)+(x4*x5)+x6 and estimate this using glmnet?
I believe I would have to create a matrix where each interaction term has its own column, but I have no idea how simply take the inputs the formula and variables(some of which are factors) and get the output a matrix I can easily put into glmnet.