findCallsParam: Determine if a function directly invokes any its arguments as...

findCallsParamR Documentation

Determine if a function directly invokes any its arguments as a function

Description

This function analyzes the code in a function and determines if it directly or indirectly invokes any of its parameters and, if so, which ones.

Usage

findCallsParam(fun, asCalls = FALSE, indirect = getIndirectCallFunList())

Arguments

fun

the R function

asCalls

a logical value. If TRUE, the function returns all of the rstatic Call nodes to these parameters. Otherwise, it returns the names of the parameters that may be invoked.

indirect

a named character vector with the names identifying functions that call one or more of their arguments.

Value

If asCalls is FALSE, a character vector identifying the names of all instances of calls to a parameter. Otherwise, a list of rstatic Call nodes.

Author(s)

Duncan Temple Lang

See Also

getGlobals and what it identifies as a function rather than a regular symbol/variable.

Examples

foo = function(x,f)    
           f(x + 1) + 2
findCallsParam(foo)

findCallsParam(optim)

duncantl/CodeAnalysis documentation built on June 12, 2025, 6:44 a.m.