[R] how to specify dev.print target by a variable?

Leif Kirschenbaum leif at reflectivity.com
Fri Dec 23 02:35:39 CET 2005


I want to do the following:

  DEVw=500
  DEVh=350
  fname="my_plot"
  dev.print(file=fname, device=FOO, width=DEVw, height=DEVh, bg="transparent")

How do I do this such that I can specify FOO to be one of several choices? (GDD, PNG, postscript, etc.)
If I make FOO a character variable, then "dev.print" complains.
I tried a simpled "substitute" but didn't get it to work...
I'm thinking it's going to involve a "do.call" and "substitute" but I'm not sure.

Using:

$platform[1] "i386-pc-mingw32"
$arch[1] "i386"
$os[1] "mingw32"
$system[1] "i386, mingw32"
$status[1] ""
$major[1] "2"
$minor[1] "2.0"
$year[1] "2005"
$month[1] "10"
$day[1] "06"
$"svn rev"[1] "35749"
$language[1] "R"

and also running the same code on:

$platform[1] "i686-redhat-linux-gnu"
$arch[1] "i686"
$os[1] "linux-gnu"
$system[1] "i686, linux-gnu"
$status[1] ""
$major[1] "2"
$minor[1] "0.0"
$year[1] "2004"
$month[1] "10"
$day[1] "04"
$language[1] "R"


-Leif S. Kirschenbaum, Ph.D.
 Yield Integration Engineer
 Reflectivity, Inc.




More information about the R-help mailing list