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

From: Leif Kirschenbaum <leif_at_reflectivity.com>
Date: Fri 23 Dec 2005 - 12:35:39 EST


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.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Dec 23 12:48:02 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST