R Under development (unstable) (2025-12-16 r89184 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > message("*** devDump() ...") *** devDump() ... > > library("R.devices") R.devices v2.17.3 successfully loaded. See ?R.devices for help. > graphics.off() > > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Copy content of current screen device > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > if (interactive()) { + # Open device + plot(1:10) + + devList0 <- devList() + devEval("png,jpg,pdf", name="count", tags="copy") + stopifnot(all.equal(devList(), devList0)) + + # Sanity checks + print(devList()) + stopifnot(length(devList()) == 1L) + + + # Same using a default name + devList0 <- devList() + devEval("png,jpg,pdf") + stopifnot(all.equal(devList(), devList0)) + stopifnot(length(devList()) == 1L) + + # Close device + devOff() + + stopifnot(length(devList()) == 0L) + + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Copy content of all screen devices + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Open several devices + idxs <- NULL + + idxs <- c(idxs, devNew()) + plot(1:10) + + idxs <- c(idxs, devNew()) + plot(cos) + + # Automatially "dump" image files of all open devices + devDump() + + # "Manual" saving of defined + which <- devList() + print(which) + + # Save all + devEval("png,pdf", which=which) + + # Close all opened devices + devOff(idxs) + } # if (interactive()) > > > message("*** devDump() ... DONE") *** devDump() ... DONE > > proc.time() user system elapsed 0.40 0.10 0.48