Skip to contents

Close only specific graphic windows (devices).

Usage

close2(kind = "pdf", return.text = FALSE, safer_check = TRUE)

Arguments

kind

Vector, among c("windows", "quartz", "x11", "X11", "pdf", "bmp", "png", "tiff"), indicating the kind of graphic windows (devices) to close. BEWARE: either "windows", "quartz", "x11" or "X11" means that all the X11 GUI graphics devices will be closed, whatever the OS used.

return.text

Single logical value. Print text regarding the kind parameter and the devices that were finally closed?

safer_check

Single logical value. Perform some "safer" checks (see https://github.com/safer-r)? If TRUE, checkings are performed before main code running: 1) R classical operators (like "<-") not overwritten by another package because of the R scope and 2) required functions and related packages effectively present in local R lybraries. Set to FALSE if this fonction is used inside another "safer" function to avoid pointless multiple checkings.

Value

Text regarding the kind parameter and the devices that were finally closed.

Author

Gael Millot <gael.millot@pasteur.fr>

Yushi Han <yushi.han2000@gmail.com>

Haiding Wang <wanghaiding442@gmail.com>

Examples

if (FALSE) { # \dontrun{
# Screen devices (windows(), quartz() and x11()) should not be used in examples
postscript(NULL) # open a postscript graphic device
pdf(NULL) # open a pdf graphic device
postscript(NULL) # open a postscript graphic device
pdf(NULL) # open a pdf graphic device
grDevices::dev.list() ; 
close2(kind = c("pdf"), return.text = TRUE) ; 
grDevices::dev.list() # only remains the postscript devices
grDevices::graphics.off()
} # }