[R] .Rdata not loading

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri Dec 24 19:30:29 CET 2021

The qsave/qread functions from the qs package are functionally interchangeable with saveRDS/readRDS, but faster and create smaller files. A simple

  if ( file.exists( "obj1.qs" ) ) {
    obj1 <- qread( "onj1.qs" )
  } else {
    obj1 <- compute_obj1()
    qsave( obj1, "obj1.qs" )

can be used but there are various caching packages [1] for ad-hoc use that attempt to determine when a computation is out of date better than the existence of a file (that you have to manually delete if you want to recompute) but they may either fail to notice relevant changes or recompute unnecessarily.  I have in the last couple of months found that the targets package [2] seems to excel at balancing these concerns and regularly use it now for large or complicated analyses. You can build the _targets.R file by hand or use a targets markdown file to build it for you and let you document your  process as you go. Once all objects are computed and in the cache then you can build reporting scripts that generate plots and tabular output that retrieve the data as needed.

[1] https://joshuacook.netlify.app/post/caching-in-r/

[2] https://books.ropensci.org/targets/

On December 24, 2021 8:31:21 AM PST, Rich Shepard <rshepard using appl-ecosys.com> wrote:
>On Fri, 24 Dec 2021, Adrian Dușa wrote:
>> Package admisc has a function called obj.rda(), which returns the names of
>> the objects from an .Rdata file. Not sure how it handles corrupt .Rdata
>> files, but should generally give an idea about what's inside.
>Thank you. I know what dataframes and plots should be in there. I'll
>probably end up running all scripts again, in sequence, and reconstructing
>what's lost. And, I'm experimenting with qs (quick save) to understand what
>it does and how to use it.
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list