is_interactive {rlang} | R Documentation |
Like base::interactive()
, is_interactive()
returns TRUE
when
the function runs interactively and FALSE
when it runs in batch
mode. It also checks:
Whether knitr or an RStudio notebook is in progress.
The rlang_interactive
global option. If set to a single TRUE
or FALSE
, is_interactive()
returns that value instead. This
escape hatch is useful in unit tests or to manually turn on
interactive features in RMarkdown outputs.
with_interactive()
and scoped_interactive()
set the global
option conveniently.
is_interactive() scoped_interactive(value = TRUE, frame = caller_env()) with_interactive(expr, value = TRUE)
value |
A single |
frame |
The environment of a running function which defines the scope of the temporary options. When the function returns, the options are reset to their original values. |
expr |
An expression to evaluate with interactivity set to
|