[R] 'postscript' command within a function
Andrew C. Ward
s195404 at student.uq.edu.au
Mon Jul 7 05:34:46 CEST 2003
Edoardo,
I'm wondering why
postscript(file=filename)
doesn't suffice, and you need to use "eval" instead?
Regards,
Andrew C. Ward
CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
andreww at cheque.uq.edu.au
Quoting Edoardo Airoldi <eairoldi at stat.cmu.edu>:
> hello all,
> I am trying to print a ps file as part of a function as in:
>
> func <- function (..., filename="temp.ps") {
> # some stuff
> [...]
>
> # plot
> eval( cat("postscript(\"",filename,"\")\n", sep="") )
> plot(...)
> abline(...)
> dev.off()
>
> # more stuff
> [...]
> }
>
> but it does not work. Nor it does with 'paste' instead of
> 'cat'. In
> order to make it work I have to call:
> > postscript("temp.ps")
> > func(...)
> > dev.off()
>
> I am wondering why is that? How can I make my call to
> postscript within a
> function sort of 'global' ??
> thanks
> Edo
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list