[R] Not saving plot

Joel joda2457 at student.uu.se
Wed Sep 28 14:19:14 CEST 2011


Hi

I got a strange problem.

I got this code:
poc<-function(USER="nana",REGISTRY="nana",...){
require(RMySQL)
require(R2HTML)
require(lattice)

... (removed the dataprocessing)


toReturn=capture.output(HTML(as.title("En liten
rapport!"),file="",align="center"))
fileDir<-paste("/home/joel/tmpR/rikssvikt/",USER,sep="");
fileName<-tempfile(pattern="UTT1", tmpdir="");
try(png(paste(fileDir,fileName,".png",sep="")));
barchart(toPlot,xlab="Antal körningar");
dev.off();
gfn <-paste("filemanager?USERID=",USER,"&file=",fileName,".png",sep="");
tmp<-capture.output(HTMLInsertGraph(file="",GraphFileName=gfn));
toReturn<-paste(toReturn,substr(tmp,1,nchar(tmp)-8));

return(paste("<div>",toReturn[2],"</div>",sep=""))
}

When I just run the code without its being in the function in works and
saves the plot at the designated location. But when I instead try to run the
code when its inside the function it dossent save the plot at all.
Anyone know why that is?

//joel

--
View this message in context: http://r.789695.n4.nabble.com/Not-saving-plot-tp3850981p3850981.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list