[Stable]

Will block R console until an expression evaluates to be TRUE.

wait_for(x, timeout = NULL, interval = 1)

Arguments

x

Boolean expression to evaluate.

timeout

Numeric. Maximum time (in seconds) to wait.

interval

Numeric. The polling interval in seconds (default=1).

Value

Invisibly returns TRUE indicating value of x after waiting for x to be TRUE.

See also

Examples


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

## requires NONMEM to be installed
if (FALSE) {

## the following are identical
m1 %>% run_nm() %>% wait_finish()

wait_for(is_finished(m1)) ## wait_finish is a more convenient form of this
}