env_is_user_facing {rlang}R Documentation

Is frame environment user facing?

Description

Detects if env is user-facing, that is, whether it's an environment that inherits from:

If either is true, we consider env to belong to an evaluation frame that was called directly by the end user. This is by contrast to indirect calls by third party functions which are not user facing.

For instance the lifecycle package uses env_is_user_facing() to figure out whether a deprecated function was called directly or indirectly, and select an appropriate verbosity level as a function of that.

Usage

env_is_user_facing(env)

Arguments

env

An environment.

Escape hatch

You can override the return value of env_is_user_facing() by setting the global option "rlang_user_facing" to:

Examples

fn <- function() {
  env_is_user_facing(caller_env())
}

# Direct call of `fn()` from the global env
with(global_env(), fn())

# Indirect call of `fn()` from a package
with(ns_env("utils"), fn())

[Package rlang version 1.1.3 Index]