-2

I want to open eps file from my R result. Below is my code for the generating eps file.

Is there a way of opening the file in R ? or How can I open it?

Please let me know.

if(iter%%nsave==0){
    
    # Save MCMC output
    blocknow=iter/nsave
    save(THETA,file=paste("MCMC/G",Gr,"C",Chain,"/Theta",blocknow,".Rdata",sep=""))
    save(PHI,GAMMA,DELTA,SIGMAETA,SIGMAEPS,MUPHI,MUGAMMA,MUDELTA,SIGMAPHI,SIGMAGAMMA,SIGMADELTA,file=paste("MCMC/G",Gr,"C",Chain,"/Pars", blocknow,".Rdata",sep=""))
    
    # Plot MCMC output
    postscript(file=paste("FIGS/Monitor_SigmaEtaEps.eps"));    par(mfrow=c(2,2));plot.ts(SIGMAETA[1,1,1,]);plot.ts(SIGMAETA[2,2,1,]);plot.ts(SIGMAEPS[1,1,1,]);plot.ts(SIGMAEPS[2,2,1,]);dev.off()
    postscript(file=paste("FIGS/Monitor_MuPhi.eps"));          par(mfcol=c(4,5));for(par in 1:20){plot.ts(MUPHI[par,1,],ylim=c(-1,1))};dev.off()
    #postscript(file=paste("FIGS/Monitor_MuGammaDelta.eps"));   par(mfcol=c(2,2));for(par in 1:2){plot.ts(MUGAMMA[par,1,]);plot.ts(MUDELTA[par,1,])};dev.off()
    postscript(file=paste("FIGS/Monitor_SigmaPhi.eps"));       par(mfcol=c(4,5));for(par in 1:20){plot.ts(SIGMAPHI[par,par,1,])};dev.off()
    #postscript(file=paste("FIGS/Monitor_SigmaGammaDelta.eps"));par(mfcol=c(2,2));for(par in 1:2){plot.ts(SIGMAGAMMA[par,par,1,]);plot.ts(SIGMADELTA[par,par,1,],ylim=c(0,4))};dev.off()
  }
Ian Campbell
  • 23,484
  • 14
  • 36
  • 57
user3901071
  • 21
  • 1
  • 3

1 Answers1

1

eps files are just a type of postscript and they are text files. Any function that can read from a file should be able to handle it, readLines() for instance:

postscript("cm_test.eps", width = 4.0, height = 3.0,
           horizontal = FALSE, onefile = FALSE, paper = "special",
           family = "ComputerModern", encoding = "TeXtext.enc")
plot(1,1); dev.off()

> readLines("cm_test.eps", n=10)
 [1] "%!PS-Adobe-3.0 EPSF-3.0"               "%%DocumentNeededResources: font CMR10"
 [3] "%%+ font CMBX10"                       "%%+ font CMSL10"                      
 [5] "%%+ font CMBXSL10"                     "%%+ font CMSY10 CMBSY10 CMMI10"       
 [7] "%%Title: R Graphics Output"            "%%Creator: R Software"                
 [9] "%%Pages: (atend)"                      "%%BoundingBox: 0 0 288 216"           
IRTFM
  • 258,963
  • 21
  • 364
  • 487