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)

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.

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 May 9, 2024, 3:04 a.m.