R: update a graph dynamically THis is a data visualization question. I have a database that contains some data that is constantly revised (online update).
What is the best way in R to update a graph every let say 5 or 10 seconds. (without plotting again the all thing is possible)?
fRed
 A: For offline visualization, you can generate PNG files and convert them to an animated GIF using ImageMagick. I used it for demonstration (this redraw all data, though):
source(url("http://aliquote.org/pub/spin_plot.R"))
dd <- replicate(3, rnorm(100))
spin.plot(dd)

This generates several PNG files, prefixed with fig. Then, on an un*x shell, 
convert -delay 20 -loop 0 fig*.png sequence.gif

gives this animation (which is inspired from Modern Applied Biostatistical Methods using S-Plus, S. Selvin, 1998):

Another option which looks much more promising is to rely on the animation package. There is an example with a Moving Window Auto-Regression that should let you go started with.
A: Assuming you want to update R windows() or x11() graph, you can use functions like points() and lines() to add new points or extend lines on a graph without redraw; yet note that this won't change the axes range to accommodate points that may go out of view. In general it is usually a good idea to make the plotting itself instantaneous -- for instance by moving computation effort into making some reduced middle representation which can be plotted rapidly, like density map instead of huge number of points or reducing resolution of line plots (this may be complex though).
For holding R session for a certain time without busy wait, use Sys.sleep().
