I would like to extract the glmnet generated model coefficients and create a SQL query from them. The function coef(cv.glmnet.fit)
yields a 'dgCMatrix
' object. When I convert it to a matrix using as.matrix
, the variable names are lost and only the coefficient values are left behind.
I know one can print the coefficients in the screen, however is it possible to write the names to a data frame?
Can anybody assist to extract these names?