[R] Loop Delaying

Yves Gauvreau cyg at sympatico.ca
Mon Jul 31 16:27:35 CEST 2000


Hi,

How about inserting a while loop in your for loop that would do nothing
until a preset amount of time as past.

Something like:

wait <- function(wait.time = 5){
  now <- proc.time()[3]
  while(proc.time()[3] < (now + wait.time)) dum <- 0
}

Regards

YG



----- Original Message -----
From: "Ko-Kang Wang" <Ko-Kang at xtra.co.nz>
To: "R Help" <r-help at stat.math.ethz.ch>
Sent: Monday, July 31, 2000 7:56 AM
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.
>
> Anyway, just wonder if the for loop can be slowed down forcebly.
>
> Cheers,
>
> Ko-Kang (Kevin) Wang
>
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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