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

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Sat Dec 24 16:47:14 CET 2022


dear Ivan,
                  Thanks for the reply. One last question:


  1.  How do you debug if there is an error, particularly if I run the script from the BASH prompt? The closest I have come to debugging a script is when I source the script in Rstudio. There everything is intiutive...but from the Linux prompt?

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Ivan Krylov <krylov.r00t using gmail.com>
Sent: Saturday, December 24, 2022 8:52 PM
To: akshay kulkarni <akshay_e4 using hotmail.com>
Cc: R help Mailing list <r-help using r-project.org>
Subject: Re: [R] difference between script and a function....

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

	[[alternative HTML version deleted]]



More information about the R-help mailing list