[R] Not saving plot

Ben Tupper btupper at bigelow.org
Wed Sep 28 15:51:09 CEST 2011


On Sep 28, 2011, at 8:19 AM, Joel wrote:

> 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?
> 

Hi,

Might this be related to R FAQ 7.22?  

http://cran.r-project.org/doc/FAQ/R-FAQ.html

Cheers,
Ben



> //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.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd. P.O. Box 475
West Boothbay Harbor, Maine   04575-0475 
http://www.bigelow.org



More information about the R-help mailing list