Identify functions called by a given function within a specified project folder
Value
A data.table with two columns ("from" and "to") representing the dependencies of the target function. Returns NA if no dependencies are found.
Details
The function identifies functions called by the target function fname
within the specified
package environment pkg_env
. It searches for dependencies within the literal code of the
function body and returns a data.table with two columns ("from" and "to") representing the
dependencies. If no dependencies are found, it returns a data.table with "from" as the target
function and "to" as NA.
Note: This function may potentially miss calls if they are in attributes of the closure. For example when function is defined within another function, capturing the environment of the outer function.
Examples
if (FALSE) { # \dontrun{
# Identify functions called by a specific function
.called_by(
fname = "my_function",
all_functions = c("function1", "function2", "function3"),
pkg_env = environment())
} # }