From savicky at cs.cas.cz  Sat Nov 13 11:44:37 2010
From: savicky at cs.cas.cz (Petr Savicky)
Date: Sat, 13 Nov 2010 11:44:37 +0100
Subject: [Rd] opening graphics device with a given number
Message-ID: <20101113104437.GA1994@cs.cas.cz>

I am preparing a script, which uses three graphical windows for different
types of plots. Before each plot, the device can be chosen by dev.set(k)
for k = 2, 3, 4. The function dev.set(k) does not create the required
device, if it is not opened already. So, instead, i use dev.add(k)
defined as

  dev.add <- function(k)
  {
      stopifnot(k >= 2 && k <= 63)
      while (all(dev.list() != k)) {
          dev.new()
      }
      dev.set(k)
  }

If the device k was not opened, then all the devices with numbers
smaller than k, which were not opened already, are created.
Usually, i use an interval of the device numbers, but sometimes,
it could be useful to open, say, device 4, even if device 3
is not needed. Is there a way, how to open a device with a
given number without opening devices with smaller numbers?

Petr Savicky.



[Rd] opening graphics device with a given number
Petr Savicky