whoami 1.3.0 uses things like
system("getent passwd $(whoami)", intern = TRUE)
which I can not tryCatch
, as it gives no error nor warning.
So this function returns a fallback if the condition given is not
TRUE
.
call_conditionally(f, condition, fallback, ..., harden = FALSE)
The function passed to do.call
.
An expression.
See Description.
arguments passed to do.call
.
The return value of f
or fallback
.
Other call functions:
call_safe()
# NOT RUN {
call_conditionally(get_package_version,
condition = TRUE,
args = list(x = "fritools"),
fallback = "0.0")
call_conditionally(get_package_version,
condition = FALSE,
args = list(x = "fritools"),
fallback = "0.0")
call_conditionally(get_package_version,
condition = TRUE,
args = list(x = "not_there"),
harden = TRUE,
fallback = "0.0")
# }
Run the code above in your browser using DataLab