Prradep - 27 days ago 13

R Question

I have 5 logistic models trained using the private data. I want them to be validated on another private data by another member. How do I share share the trained models such that they can be evaluated on another system running an arbitrary version of R and packages (i.e. as portably as possible)? I know about

`.RData`

Edit:

Tried the approach mentioned using

`save`

`load`

`save(Model1, file = "my_model1.test.rda")`

model_diff <- load('my_model1.test.rda')

model_diff

[1] "Model1"

But the loaded model

`model_diff`

`"Model1"`

Answer

If anyone looking for answer, models can be saved using `saveRDS()`

```
saveRDS(lm.model, 'my_model.rds')
```

and load them in different session using `readRDS()`

function

```
Model_load <- readRDS('my_model.rds')
```

based on m-dz's answer.