[R] 'pausing' in R

Gardar Johannesson gardar at stat.ohio-state.edu
Thu Jun 22 02:45:04 CEST 2000

I have this 'odd' problem; I need to let R pause, for a given time, before
starting next iteration in a loop.  I'm using the following to do this
task, but feel a little bit guilty because I'm using as much CPU time as I
can get while pausing:

while(keepGoing) {
  t.end <- proc.time()[3] + 5  ## the time this loop should end at

  [block of R commands]
  while(proc.time()[3] < t.end) {}

This guaranty, at least, 5 second evaluation time for each loop in the
above case.

Can I delay the loop more efficiently, that is, not using as much CPU time
as in the above case?


I'm using version 1.1.0 on:
Machine hardware:   sun4u
OS version:         5.7
Processor type:     sparc
Hardware:           SUNW,Ultra-250

Gardar Johannesson		     Home Addr.
 Department of Statistics              605 Dennison, #3
Ohio State University                  Columbus, OH 43215
305A Cockins Hall, 1958 Neil Av.       Tel: 614-531-0102
Columbus, OH 43210                          ( cellular )
Tel: 614-292-6038
Fax: 614-292-2096
e-mail: gardar at stat.ohio-state.edu
WWW: www.stat.ohio-state.edu

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