# arg_inspect

0th

Percentile

##### Inspect an argument

arg_inspect() provides argument introspection in the context of lazy evaluation. Compared to tidy_capture(), the returned information is more complete and takes R's lazy evaluation semantics into account: if an argument is passed around without being evaluated, arg_inspect() is able to return the expression at the original call site as well as the relevant scoping environment in which this expression is supposed to be evaluated when the argument is forced. To accomplish this, arg_inspect() climbs the call stack to find where an argument was first supplied, with which expression, in which evaluation environment. arg_inspect_() is the standard-evaluation version of arg_inspect() and takes a symbol and a call stack object.

##### Usage
arg_inspect(x)
arg_inspect_(expr, stack, only_dots = FALSE)
##### Arguments
x
An argument to a function.
expr
A quoted symbol giving the name of the argument to inspect.
stack
A call_stack object as returned by call_stack().
only_dots
Whether to stop introspection once forwarded dots have been climbed. Setting this to TRUE is only useful for inspecting dots (cf. tidy_dots() which does not follow symbols).
##### Details

arg_inspect() should be used with two caveats in mind. First, it is slower than tidy_capture() and lazyeval::lazy(). Thus you should probably avoid using it in functions that might be used in tight loops (such as a loop over the rows of data frame). Second, arg_inspect() ignores all reassignment of arguments. It has no way of detecting that an inspected argument got reassigned along the way, and will continue to climb the calls looking for an earlier call site. These two limitations are inherent to the stack climbing approach that powers this function.

##### Value

A list containing:

##### Aliases
• arg_inspect
• arg_inspect_
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

### Community examples

Looks like there are no examples yet.