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("*** devSet() ...") *** devSet() ... > > library("R.devices") R.devices v2.17.3 successfully loaded. See ?R.devices for help. > > set.seed(0xBEEF) > > devList0 <- devList() > > # Open several devices in random order > idxs <- sample(2:20, size=5L, replace=FALSE) > for (idx in idxs) { + idxT <- devSet(idx) + # Sanity check + stopifnot(idxT == idx) + } > > # Close all devices > devOff(idxs) null device 1 > > # Sanity check > stopifnot(all.equal(devList(), devList0)) > > > keys <- list( + A = list(a=1, b=2, c=3), + B = list(a=1, b=2, c=4), + C = list(a=1, b=2), + D = c(a=1, b=2, c=3) + ) > > # Open several devices using key objects > idxs <- NULL > for (key in keys) { + idx <- devSet(key) + idxs <- c(idxs, idx) + } Loading required namespace: digest > > # Close all devices > devOff(idxs) null device 1 > > # Sanity check > stopifnot(all.equal(devList(), devList0)) > > > # Open several devices using labels > labels <- c("A", "B", "C", "D") > > for (rev in c(FALSE, TRUE)) { + for (label in labels) devSet(label) + + if (rev) labels <- rev(labels) + for (label in labels) { + devOff(label) + left <- devList() + stopifnot(!is.element(label, names(left))) + } + } > > # Sanity check > stopifnot(all.equal(devList(), devList0)) > > > message("*** devSet() ... DONE") *** devSet() ... DONE > > > proc.time() user system elapsed 0.70 0.21 0.90