
Check whether code runs at the top level of the console
Source:R/is_run_directly.R
is_run_directly.Rdis_run_directly() returns TRUE when you call it at the top level of the R
console or of an Rscript file. It returns FALSE inside a function, and
inside source(), eval() and a knitr chunk.
Details
Put it at the start of an action function to load data and argset while
you develop the function line by line. When the plan runs the function, it
returns FALSE, so the lines do nothing.
See also
vignette("plnr"), whose "Debugging" section shows the pattern.
Other plan helpers:
Plan,
expand_list(),
get_anything(),
set_opts()