[R] filename of current device

Andreas Leha andreas.leha at med.uni-goettingen.de
Thu May 15 00:44:59 CEST 2014


Hi David,

Thank you for following up on that.

David Winsemius <dwinsemius at comcast.net> writes:

> On May 14, 2014, at 3:04 PM, Andreas Leha wrote:
>
>> Hi all,
>> 
>> how do I find out about the filename, the currently open (let's say pdf)
>> device is writing to?
>> 
>> If I find 'dev.cur()' returning 'pdf 3' when I expect 'nulldevice 1' I
>> would like to know, which file that pdf device is actually targeting.
>> 
>> Any help for my poor organization is highly appreciated...
>> 
>
> Have your read the help file for pdf()? The first argument is the default naming mechanism:
>
> file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf")
>
> So if you call pdf() then it will write to the working directory with a named constructed from those choices.
>

Sorry for being unclear.  I am aware of that.  My use case is, that
apparently, I have called pdf("somefile.pdf") somewhen during a long
lasting R session.

I tend to have separate R sessions open in parallel
for the project I am working on.  So, I can easily have R session open
that run for weeks.

So, when I return to an R session (when I got some additional data, I
was asking for, e.g.) after several days, I do not know what that call
was.  And for several reasons, the actual call (pdf("somefile.pdf"))
might not even be visible in my R session.

In that situation, I would like to know, which is the open file for the
current device.

I hope that makes my question clearer.

Regards,
Andreas



More information about the R-help mailing list