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.r...@gmail.com>
Sent: Saturday, December 24, 2022 8:52 PM
To: akshay kulkarni <akshay...@hotmail.com>
Cc: R help Mailing list <r-help@r-project.org>
Subject: Re: [R] difference between script and a function....

On Sat, 24 Dec 2022 14:54:52 +0000
akshay kulkarni <akshay...@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]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to