On 02-09-2011, at 21:23, Berend Hasselman wrote:
I am running the following R code in TextMate
sessionInfo() x <- 1:20 y <- 2*x+runif(length(x), min=-2, max=2)
mean(y)
plot(x,y)
on Mac OS X 10.6.8 with R2.13.1 in TextMate 1.5.10 (1631) and the R.tmbundle.
The plot is not being refreshed every time I run the file with Command R (leaving the html window open).
When I close the output html window before doing Command R the plot does refresh.
Ideas? Fixes?
I believe the problem is caused by a recent update of WebKit, possibly the one coming with Safari 5.1 I have (at least for now) been able to construct a workaround.
In the file R.tmbundle/Support/tmR.rb there is a line
stdin.puts(%{formals(pdf)[c("file","onefile","width","height")] <- list("#{tmpDir}/Rplot%03d.pdf", FALSE, 8, 8)})
which I have replaced with
stdin.puts(%{formals(pdf)[c("file","onefile","width","height")] <- list(paste(tempfile(pattern="Rplot",tmpdir="#{tmpDir}"),"-%03d.pdf",sep=""), FALSE, 8, 8)})
generating file names with a random part. This avoids the non refresh of the pdf files containing the plots.
Berend Hasselman