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?
Berend Hasselman
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
On 3 Sep 2011, at 12:55, Berend Hasselman wrote:
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.
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.
Hi Berend,
thanks for pointing out the problem. I've just fixed it. I went another way to enforce the reloading.
rndn = Time.now.to_i # random number needed to enforce reloading of cached images
print "<img width=#{width} onclick="TextMate.system('open \'#{f}\'',null);" src='file://#{f}?#{rndn}' />"
This approach avoids the generating of lots of files while having a R session.
Cheers, --Hans
On 03-09-2011, at 14:11, Hans-Jörg Bibiko wrote:
On 3 Sep 2011, at 12:55, Berend Hasselman wrote:
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.
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.
Hi Berend,
thanks for pointing out the problem. I've just fixed it. I went another way to enforce the reloading.
rndn = Time.now.to_i # random number needed to enforce reloading of cached images
print "<img width=#{width} onclick="TextMate.system('open \'#{f}\'',null);" src='file://#{f}?#{rndn}' />"
This approach avoids the generating of lots of files while having a R session.
tmR.rb is deleting everything in the temporary directory, isn't it?
Your solution is nicer since no weird strings are inserted in the filenames.
When can I use svn to update the bundle?
Thanks very much for the fix. Much appreciated, since I use the R bundle in TextMate so often.
Berend
On 3 Sep 2011, at 14:24, Berend Hasselman wrote:
tmR.rb is deleting everything in the temporary directory, isn't it?
No. Only after rebooting or re-logging in.
Your solution is nicer since no weird strings are inserted in the filenames.
When can I use svn to update the bundle?
Now :) Or use GetBundles to keep up-to-date without using svn.
Thanks very much for the fix. Much appreciated, since I use the R bundle in TextMate so often.
:)
--Hans