-1

I extracted the coefficients from my glmnet model with code:

best_lambda_fit_coef <- coef(best_lambda_fit)

I got a list of coefficients that are in dgCMatrix, but I'm not sure how to make it a data frame. I looked the answer from Mehrad in Extracting coefficient variable names from glmnet into a data.frame, but it doesn't work for my situation. Below is the screenshot of the extracted dgCMatrix. Please advise. Thank you.

enter image description here

cheklapkok
  • 439
  • 1
  • 5
  • 11

1 Answers1

0

data.frame(matrix(unlist(best_lambda_fit_coef), nrow=251, byrow=T))