0

I got a strange problem:

I have a display function (mainly relying on gglplot2) called draw(chain) taking as an argument a coda chain.

If I call into the R console:

 chain<-read.coda(#....name etc)
 pdf(paste(outDirectory,'/plot.pdf',sep=''))
 draw(chain);
 dev.off()

plot.pdf contains what expected. However, to do a similar job if I implement a function that encapsulates the saving:

 save<-function(name1,name2,outDirectory) 
 {
 chain<-read.coda(name1,name2)
 pdf(paste(outDirectory,'/plot.pdf',sep=''))
 draw(chain);
 dev.off()
 }

and simply call

   save(name1,name2,outDirectory)

in the R console : the resulting plot.pdf is unreable. I do not know how to clear this situation but really need it! If anyone have an idea, I appreciate.

I developed under R version 2.15.2, Mac version.

4

0 回答 0