Generate a vector graphics format of an R Graph
I have an R script that generates a graph. I need it to be saved in a vector format (to retain the quality when the image is re-sized). PDF will not be very useful since it is not convenient to manipulate. And unfortunately, the postscript device isnt working for me. Please suggest an alternative format or a fix for the code snippet to generate an eps. 

    postscript("fig1.eps")
    #pdf("fig1.pdf")
    x <- seq(-pi, pi, len = 65)
    plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3)
    lines(x, cos(x), pch = 3, col = 4)
    lines(x, tan(x), pch = 4, col = 6)
    title("legend(..., lty = c(2, -1, 1), pch = c(-1,3,4), merge = TRUE)", cex.main = 1.1)
    legend(2, 1.9, c("sin", "cos", "tan"), col = c(3,4,6), lty = c(1, 1, 1))
    dev.off()

Generate a vector graphics format of an R Graph
===

I have an R script that generates a graph. I need it to be saved in a vector format (to retain the quality when the image is re-sized). PDF will not be very useful since it is not convenient to manipulate. And unfortunately, the postscript device isnt working for me. Please suggest an alternative format or a fix for the code snippet to generate an eps. 

    postscript("fig1.eps")
    #pdf("fig1.pdf")
    x <- seq(-pi, pi, len = 65)
    plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3)
    lines(x, cos(x), pch = 3, col = 4)
    lines(x, tan(x), pch = 4, col = 6)
    title("legend(..., lty = c(2, -1, 1), pch = c(-1,3,4), merge = TRUE)", cex.main = 1.1)
    legend(2, 1.9, c("sin", "cos", "tan"), col = c(3,4,6), lty = c(1, 1, 1))
    dev.off()
