5

I am wondering if anyone is aware of a way to call dev.new() and have the resulting frame launch to a second monitor by default. I'm running R through ESS under Windows 7. It defaults to upper right corner of my primary monitor.

UPDATE

dev.new(xpos=1930, ypos=65) will launch the plot window to upper left corner of my secondary monitor.

I would still be interested in how to set xpos and ypos under device, either per session, per script, or globally.

joeln
  • 167
  • 1
  • 7

1 Answers1

2

Look at getOption("device") and Sys.getenv("_R_CHECK_SCREEN_DEVICE_"). There should be your device number. I am on linux, so can't say what windowZ call these, but I get a number. If the default one is 1, than if I set it to 2, i get it on the external monitor.

Psidom
  • 209,562
  • 33
  • 339
  • 356
mike
  • 173
  • 11
  • So what exactly are you saying one should do? Are these numbers supposed to go into `dev.new()`, like `dev.new(2)`? Didn't do anything on my Win 10 machine. – Mike Wise Jun 09 '16 at 20:28
  • 1
    Thanks hike. `getOption` got me to a call per device (updated above). However, `Sys.getenv("_R_CHECK_SCREEN_DEVICE_")` returns an empty `chr`. – joeln Jun 10 '16 at 12:12
  • @joeln I do not get it. How can you use `getOption` to specify the device? Can you please post some code of it? – Nisba Sep 19 '18 at 09:09