Getting Argument From System, Option or Default
Value
if defined, the value of the option (opt
), a character
from the environment variable (sys
) or the
default
in this order of priority.
Examples
get_arg("my.option", "MY_ARG", "default")
#> [1] "default"
withr::with_envvar(c(MY_ARG = "x;y"), get_arg("my.option", "MY_ARG", "default"))
#> [1] "x" "y"
withr::with_options(c(my.option = "y"), get_arg("my.option", "MY_ARG", "default"))
#> [1] "y"