where: Return environment where function is defined

View source: R/where.R

whereR Documentation

Return environment where function is defined

Description

This is an adaptation of the function written by Hadley Wickham, see ⁠https://adv-r.hadley.nz/environments.html⁠. This version allows the user to specify the function as a string, or to use with non-standard evaluation.

Usage

where(name, env = rlang::caller_env())

Arguments

name

The name of function to search for. Can be a string, or can be evaluated with non-standard evaluation.

env

environment from which to start recursive search. Defaults to the caller environment taken from rlang::caller_env(). Note, setting the env argument to anything but the default will nullify the capability for non-standard evaluation, and string must then be used in name.

Value

environment where function is defined.

Examples

where(sum)
where("sd")


WhiteJP/jpw documentation built on April 17, 2025, 5:47 a.m.