wait_for: Wait for statement to be TRUE

View source: R/utils.R

wait_forR Documentation

Wait for statement to be TRUE

Description

[Stable]

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

Usage

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

wait_finish().

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
## Not run: 

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

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

## End(Not run)


tsahota/NMproject documentation built on Oct. 1, 2022, 11:51 a.m.