[R] Loop Delaying
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jul 31 14:26:20 CEST 2000
> Date: Mon, 31 Jul 2000 23:56:34 +1200
> From: Ko-Kang Wang <Ko-Kang at xtra.co.nz>
> X-Accept-Language: en,zh-TW,zh-CN,zh,en-GB,en-US
> To: R Help <r-help at stat.math.ethz.ch>
> Subject: [R] Loop Delaying
>
> Hi there,
>
> I know this question may sounds strange, but here it goes:
>
> Is it possible to delay the speed of a for loop? For example, if I
> have:
>
> for (i in 1:100) {
> blah blah blah
> }
>
> within the for loop I want to draw a series of plots, and combining the
> plots together I'll have an animation. Problem is the loop is too fast
> and I only see the end result (which is not surprising actually).
>
> What I want is to slow down the loop (if possible), and so I have time
> to save each "part" of the loop (or each plot when it is produced) as a
> gif file, and later on put these gif files together using some kind of
> GIF Animators.
You can save the plot from R code within the loop, e.g. by savePlot on
Windows. I suspect that is what you really want.
I suggest you don't mention GIF in connection with a GNU project, as
some people are very against them.
> Anyway, just wonder if the for loop can be slowed down forcebly.
Not easily yet, but 1.2.0 will have a Sys.sleep function to do so.
On Windows you can `borrow' this by using library(xgobi) and looking
at the .C call at the end of the xgobi function.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list