[R-pkg-devel] Error in CHECK caused by dev.off()

Berry Boessenkool berryboe@@enkoo| @end|ng |rom hotm@||@com
Sun Jul 26 12:31:43 CEST 2020

One (late) additional command:

in the following setup:


if the plotting function fails, code execution stops and dev.off never gets called, leaving (potentially nested) devices open.

I suggest:

on.exit(dev.off(), add=TRUE)

add=TRUE is technically only needed if you have several on.exit calls.
I trained myself to always include it after it bit me when I introduced more on.exit calls later on.


From: R-package-devel <r-package-devel-bounces using r-project.org> on behalf of Helmut Sch�tz <helmut.schuetz using bebac.at>
Sent: Friday, July 24, 2020 11:02
To: Duncan Murdoch <murdoch.duncan using gmail.com>
Cc: r-package-devel using r-project.org <r-package-devel using r-project.org>
Subject: Re: [R-pkg-devel] Error in CHECK caused by dev.off()

Duncan Murdoch wrote on 2020-07-24 01:05:
> On 23/07/2020 5:11 p.m., Helmut Sch�tz wrote:
>> I'm not a native speaker of English but for me "should not write" !=
>> "must not write".
> And "may be allowed" is not "will be allowed".

Which leaves the question open _who_ may -- or may not -- allow it. ;-)
>> I removed the automatic switch to "~/" if no path is given. As before I
>> recommend in the man-pages to give the full path. However, I _still_
>> state that "~/" _can_ be used for convenience.
> [...] It's fine if your documentation recommends the user choose
> that.  That's a variation on what I recommended to you (that you
> generate an error message that suggests how to avoid the error).

Yes, I've done that.


>> "C:/Users/{Username}/AppData/Local/Temp/Rtmp..." I strictly separate my
>> OSes (on C), software (on D), data (on E), backups (on F). Writing to
>> the system disk is not what I prefer. However, in my installation "~/"
>> resolves to "E:/Users/{Username}/Documents/"...
> It can resolve anywhere you like (as long as its writable), by
> specifying the TMPDIR environment variable.

Agree. Though I can change it permanently in _my_ Rcmd_environ file, in
a package I _must not_ change the users environment.


Ing. Helmut Sch�tz
BEBAC � Consultancy Services for
Bioequivalence and Bioavailability Studies
Neubaugasse 36/11
1070 Vienna, Austria
E helmut.schuetz using bebac.at
W https://bebac.at/
F https://forum.bebac.at/

R-package-devel using r-project.org mailing list

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list