2

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?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
c_R
  • 23
  • 3
  • 1
    Just a minor note: I think you're probably confusing your R version with your RStudio version. R version 1.2 was released in 2001, so unless you are *extremely* out of date, 1.0.136 is probably not your R version. – Gregor Thomas Dec 14 '20 at 22:29

1 Answers1

2

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.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • 1
    Of course this is dependent on the objects created by the old version of `reprtree` being compatible with the newer versions of `rpart.plot`. No good way to find that out except to try! – Gregor Thomas Dec 14 '20 at 22:27
  • if this solved your problem you're encouraged to click the check-mark to accept it (you may have to wait a little while). Note that "thank-you" comments are actually deprecated on SO (as being "noise"), but the spirit is still appreciated – Ben Bolker Dec 14 '20 at 22:40