Learn R Programming

fritools (version 3.3.0)

call_safe: Call a Function Given an External Dependency on Non-Windows Systems

Description

Just a specialized version of call_conditionally.

Usage

call_safe(f, dependency, fallback = "Fallback", ...)

Arguments

f

The function passed to do.call.

dependency

The external dependency, see Examples.

fallback

See Description.

...

arguments passed to do.call.

Value

The return value of f or fallback.

See Also

Other call functions: call_conditionally()

Examples

Run this code
# NOT RUN {
call_safe(whoami::email_address, dependency = "whoami",
          args = list(fallback = "foobar@nowhere.com"),
          fallback = "nobar@nowhere.com")
call_safe(whoami::email_address, dependency = "this_is_not_installed",
          args = list(fallback = "foobar@nowhere.com"),
          fallback = "nobar@nowhere.com")
# }

Run the code above in your browser using DataLab