Skip to content
Prev 65623 / 398506 Next

function in order to plot the same graph to postscript an d pdf

This works for me:

plot.both <- function(expr, filename) {
     pdf(file=paste(filename, ".pdf", sep=""))
     eval(expr)
     dev.off()
     postscript(file=paste(filename, ".eps", sep=""))
     eval(expr)
    dev.off()
}

plot.both(expression(plot(1:10)), "testboth")


Andy

PS:  Please make sure you post correct code.  The code you posted has syntax
(and other) errors.