gov_wait {governor} | R Documentation |
gov
Wait an appropriate amount of time within a for-loop to match the desired
interval set in gov
gov_wait(gov)
gov |
object created by |
Logical value. If TRUE
then the governor is suggesting that
the work for next loop be skipped if the loop interval is to
be maintained in the long term.
# This loop should take approx 1 second
gov <- gov_init(1/30) # interval = 0.0333 seconds
system.time({
for (i in 1:30) {
Sys.sleep(0.01) # Work done in loop
gov_wait(gov) # Compensate to keep interval loop time
}
})