gov_wait {governor} | R Documentation |
Wait an appropriate amount of time within a for-loop to match the desired
interval set in gov
Description
Wait an appropriate amount of time within a for-loop to match the desired
interval set in gov
Usage
gov_wait(gov)
Arguments
gov |
object created by |
Value
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.
Examples
# 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
}
})
[Package governor version 0.1.2 Index]