Search code examples
rglmglmnet

How to save a glmnet model to a file in R?


When I am using R, how can I save a model built by glmnet to a file, and then read it from the file so as to use it to predict?

Is it also the same if I use cv.glmnet to build the model?

Thanks!


Solution

  • Maybe I misunderstand your point, but it is always feasible to use the save function to save your R object in the .RData file. Next time, you simply use load(YourFile.RData) to load the object(s) into session.