[R] R 1.1.0 dev.print() & dev.copy2eps -- bug{let}

Martin Maechler maechler at stat.math.ethz.ch
Thu Jul 6 17:36:28 CEST 2000

>>>>> "StEgl" == Stephen Eglen <stephen at cogsci.ed.ac.uk> writes:

    StEgl> Hi, I just upgraded to 1.1.0 from 1.0.1 this morning on my OSF/1
    StEgl> machine.  I now have problems with the following code:

    StEgl> %E /tmp 43% R --vanilla
    StEgl> Version 1.1.0  (June 15, 2000)
    StEgl> ...

    >> test2 <- function ()
    ofile <- "/tmp/newfile.ps"
    dev.print(file = ofile)

    StEgl> + + + + + > > test2()
    StEgl> Error in device(...) : Object "ofile" not found

    StEgl> However, if I just write the filename directly into the call to
    StEgl> dev.print() rather than using a variable name, it works okay:

    >> test1 <- function ()
     dev.print(file = "/tmp/newfile.ps")

    StEgl> + + + + > > test1()
    StEgl> X11 
    StEgl> 2 

    StEgl> I just checked, and test1() works fine on R-1.0.1 
you mean  test2();  test1() works on both, right?!

    StEgl> - what am I doing wrong?
nothing, "of course".
You found a bug, and hence I'm CC'ing to R-bugs.

Maybe, dev.print() is not what you should  have been using in the first place,
but rather dev.copy() directly which will probably solve your problem.

NOTE:  dev.print() has been extensively re-worked (for 1.1.0) in order to
       be "smart", e.g.,. to send the current plot to the printer by default
       depending on getOption("printer") and other things, and to allow
       other uses.  Hence, it works on the call and uses eval() ...

It seems is must become even smarter (or less tricky and more robust)...
BTW, the same applies to the new  dev.copy2eps() function which falls in
the same pit in its trickyness of using eval(...) :

  > tst3 <- function(outfile) { dev.copy2eps(file = outfile) }
  > tst3("/tmp/my2.eps")
  Error in device(...) : Object "outfile" not found

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list