[R-pkg-devel] R CMD BATCH plot output
Ben Bolker
bbo|ker @end|ng |rom gm@||@com
Sun Jul 28 22:14:58 CEST 2024
Dirk Eddelbuettel would tell you to use his 'little r' script instead,
though not sure if it has this particular flexibility. You could wrap R CMD
BATCH in your own script that moved Rplots.pdf where you wanted it ...
On Sun, Jul 28, 2024, 4:05 PM Josiah Parry <josiah.parry using gmail.com> wrote:
> Thanks, Duncan!
>
> Is there a way to override this using the command line arguments?
>
> I'd like to be able to have a generalizable way to address this without
> having to modify R source code.
>
> My understanding is that when there is a plot output, R CMD BATCH uses the
> PDF device which is a fair default.
>
> However, there is not any use of `dev.new()` or `pdf()` called anywhere in
> the code.
>
> On Sun, Jul 28, 2024 at 3:44 PM Duncan Murdoch <murdoch.duncan using gmail.com>
> wrote:
>
> > On 2024-07-28 1:48 p.m., Josiah Parry wrote:
> > > Hey folks! I am working with R CMD BATCH and providing a providing a
> > > logfile output e.g.
> > >
> > > R CMD BATCH main.R 2024-07-28.log
> > >
> > > This creates the desired log file with the contents of stdout and
> stderr.
> > >
> > > 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
> > explicitly and you can specify any file you like.
> >
> > That is,
> >
> > plot(rnorm(100))
> >
> > will call dev.new() which in a non-interactive session calls pdf(). If
> > you specify
> >
> > dev.new(file = "something.pdf")
> > plot(rnorm(100))
> >
> > the "file" argument will be ignored in an interactive session, but will
> > be used in a non-interactive one.
> >
> > Duncan Murdoch
> >
> >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list