[R-pkg-devel] R CMD BATCH plot output
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Sun Jul 28 22:27:33 CEST 2024
On 28 July 2024 at 15:44, Duncan Murdoch wrote:
| On 2024-07-28 1:48 p.m., Josiah Parry wrote:
| > However, if plots are generated in the process, the plots are stored in
| > Rplots.pdf.
| >
| > Is there a way via command line arguments to change the name of the pdf
| > output.
| >
| > There might be multiple runs of this script and it would be ideal to store
| > the plot output independently.
|
| That's the default filename if you open a PDF device. Open it
It's the default (and fallback) device and filename you fail to specify
something else. Ie 'Rscript -e "plot(1:10)"' will create it too.
My preferred alternative is to wrap call to plot() with actual device create
(something like 'if (!interactive()) pdf(my_filename, 8. 6)' with a
corresponding 'if (!interactive()) dev.off()' to ensure the file finalised
and close.
If we cannot (or do not want to) modify the given main.R, I would suggest
something along the lines of
Rscript -e 'pdf(myfilenamevar); source("main.R"); dev.off()' | tee 2024-07-28.log
and Bob's your uncle now in terms of how you spec the filename.
In short, I would let go of `R CMD BATCH` if it does not do what you want.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-package-devel
mailing list