Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wait

Wait for an event


Description

wait waits until an event occurs or times out

Usage

wait(x, ...)
## Default S3 method:
wait(x, timeout, ...)
## S3 method for class 'audioInstance'
wait(x, timeout=NA, ...)

Arguments

x

event to wait for

timeout

longest period to wait for (in seconds, real number). A value of 0 causes wait to just check for the event, values NA and less than zero mean to wait indefinitely until the even occurs.

...

optional arguments passed to the method specific to the object being monitored

Details

The default method allows x to specify the timeout, i.e., if timeout is not specified and x is numeric then the timeout is set to x.

Value

Returns the result.

Examples

# play a sound and wait until the playback is done
wait(play(sin(1:10000/20)))
# wait for 2.5 seconds unconditionally
wait(2.5)

audio

Audio Interface for R

v0.1-10
MIT + file LICENSE
Authors
Simon Urbanek <simon.urbanek@r-project.org>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.