Learn R Programming

fritools (version 4.6.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", ...)

Value

The return value of f or fallback.

Arguments

f

The function passed to do.call.

dependency

The external dependency, see Examples.

fallback

See Description.

...

arguments passed to do.call.

See Also

Other call functions: call_conditionally()

Examples

Run this code
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