Oct 202008
Yesterday I wrote some R code to simulate the quincunx, which looks like:
It will appear as a function in the R package animation soon.
Oct 152008
Here is an example of dynamically selecting points using R (the function getGraphicsEvent()):
par(bg = "black", mar = rep(0, 4), pch = 20)
xx = runif(100)
yy = runif(100)
plot(xx, yy, type = "n")
mousemove = function(buttons, x, y) {
r = 0.2
idx = (x - r < xx & xx < x + r) & (y - r < yy & yy < y + r)
plot(xx, yy, type = "n")
rect(x - r, y - r, x + r, y + r, border = "yellow", lty = 2)
points(xx[idx], yy[idx], col = "yellow", cex = 2)
points(xx[!idx], yy[!idx], col = "red")
NULL
}
mousedown = function(buttons, x, y) {
"Done"
}
getGraphicsEvent("Click mouse to exit", onMouseDown = mousedown,
onMouseMove = mousemove)
We can adjust the parameter r as we wish.

Dynamically Selecting Points Using R (Screen Snapshot)
Oct 122008
I‘d like to thank Prof Michael Friendly for telling me this: just create a hyperlink to the file with the run protocol and then you can open a file directly from the hyperlink. For example, in LaTeX with hyperref package, you may use \href{run:path/to/some.file}{some link} to open this some.file in your PDF. This is a useful hack that I have been looking for over a long time.
Recent Comments