[R] Loop Delaying

Peter Malewski y0004379 at tu-bs.de
Mon Jul 31 15:04:00 CEST 2000

On Mon, 31 Jul 2000, Ko-Kang Wang wrote:

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

Several days before was a similar question, I don't know the answers but i
would guess that slowing might be one possibility (done by a additional
inside loop that does nothing)
for( i in ...){
   for(j in 1:100000)rnorm(100)

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

a better way might be -perhaps- to set

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

...or you automatically save the plots 

dev.print(postscript,file=paste("foo",i,sep="") )

...look on them later...

or you use the possibilty to make several pages

> postscript(file="/tmp/temp.ps")
> plot(0,0)
> plot(0,0)
> plot(0,0)
> dev.off()


** To YOU I'm an atheist; to God, I'm the Loyal Opposition. Woody Allen **
P.Malewski					Tel.: 0531 500965
Maschplatz 8					Email: P.Malewski at tu-bs.de
************************38114 Braunschweig********************************

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