fm_call_ns_name: Detect Namespace of Function Call

View source: R/compare_mids.R

fm_call_ns_nameR Documentation

Detect Namespace of Function Call

Description

Tries to detect the namespace of a call automatically. It will first try to extract the namespace using rlang::call_ns(); if this fails, it will use the supplied env (rlang::caller_env(), by default) to attempt to extract the namespace from the call's function. The latter method is similar to rlang::call_fn(), which is now deprecated due to inconsistent results. It is not yet clear whether this works well enough to retain the behavior in practice.

Usage

fm_call_ns_name(call, env = rlang::caller_env(), error = TRUE)

Arguments

call

A call object to extract a namespace from

env

The environment to use to lookup the function definition from call if the call is not explicitly namespaced

error

Should the function throw an error if call is not a call object?

Value

The name of the associated namespace, if detected; if not, returns NULL


jesse-smith/futuremice documentation built on Nov. 24, 2023, 7:19 a.m.