0

What is the best way to save all I've done in an R session, so that I can use it in a different session without re-running all of the code each time? I've used save.image() to save a workspace, but this does not load packages, etc.

I previously used session::save.session("sessionname.rda") to save an R session, which also loaded packages and attached data objects. I used session::restore.session() to restore this session information.

I just updated to R to R-4.2.1 for Windows and use R studio 2022.07.1 Build 554, and since then, when I try session::save.session("sessionname.rda") I get an error that reads: Error in loadNamespace(x) : there is no package called ‘session’. When I go to install the package, I get "package ‘session’ is not available for this version of R" (see below).

install.packages("session") Installing package into ‘C:/Users/dena/AppData/Local/R/win-library/4.2’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘session’ is not available for this version of R A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

I am somewhat new to R and am not sure where in the provided URL to find info I may need. Thanks for your help!

  • I recommend you just save your script, you can run it each time and it will recreate the work you've done every time you run it. That's actually the point of a script. If there are computations that take a very long time, say longer than a few seconds, you might want to save intermediate results; look into `?saveRDS` for this. – jay.sf Sep 23 '22 at 04:37

0 Answers0