[R] difference between script and a function....

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Sat Dec 24 16:22:44 CET 2022


On Sat, 24 Dec 2022 14:54:52 +0000
akshay kulkarni <akshay_e4 using hotmail.com> wrote:

> If there is  some error in the script, the error will be output to
> the stdout? Or to the file that it creates for saving the output of
> the script?

When using Rscript: to stderr, to be precise.

When using R CMD BATCH: to the Rout file.

> Will ALL the intermediate objects be stored ?

May I shamelessly plug my own package, depcache? Using its cache()
function, you can save intermediate objects into *.rds files in a
relatively transparent manner. By default, they are stored in a
subdirectory of the working directory. A downside is that I haven't
come up with a useful cache expiration strategy yet.

A more involved approach that will also let you access your
intermediates is provided by the "targets" package, not only on CRAN
but also peer-reviewed by rOpenSci.

-- 
Best regards,
Ivan



More information about the R-help mailing list