且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 R 中保存和加载模型

更新时间:2023-12-01 22:14:40

现在更好的解决方案是使用 saveRDS 保存和 readRDS 读取:

A better solution nowadays is to use saveRDS to save and readRDS to read:

saveRDS(model, "model.rds")
my_model <- readRDS("model.rds")

这让您可以为对象选择一个新名称(您无需记住保存时使用的名称)

This lets you to choose a new name for the object (you don't need to remember the name you used when you saved it)