Search code examples
rmodelrandom-forestenvironmentrpart

Save a workspace and open it on another computer


I created a model (a tree object from a random forest) working on a old version of R (1.0.136) because the package (reprtree) I needed didn't work on the new version.

Now I want to analyse my model using more recent packages (rpart.plot), which is only possible on a more recent version of R, so on another computer.

Is there a way to save the environment and open it in the other session?


Solution

  • As far as I know save.image() should create a file that is forward-compatible, i.e. you can create it with an older version of R and load it in a newer version (use load() to restore it on the far end).

    There was a change in the save format around R version 3.5.0 (I believe the version number you gave above is an RStudio version number, which is probably irrelevant here ...) Unless you specify version=2 when saving on a more recent (>3.5) R version, your image will not be backward compatible to older R versions.