find_functions {lazy.tools} | R Documentation |
Find Functions used in a Function or Functions in a List of Function Names
find_functions(func, nonative = 1, noglobal = 0, sort = 1, packages = NULL, unlist = 1)
func |
A function object (no quote) or a list/vector of the function object names. |
nonative |
= 0 to print the R native functions. |
noglobal |
= 1 not to print the functions defined in the global env. |
sort |
= 0 not to sort the result |
packages |
A character vector containing the names of the packages.
|
unlist |
= 0 to output the result in a list when func is a list or vector. |
This function requires "codetools" package.
A character vector containing the function names.
The answer by kohske (answered Aug 9 '12 at 7:51) at:
http://stackoverflow.com/questions/11872879/
finding-out-which-functions-are-called-within-a-given-function
## Not run: library(codetools) library(lazy.tools) find_functions( is.varname ) res1 <- find_functions( ls("package:lazy.tools") ) res2 <- find_functions( ls("package:lazy.tools"), unlist=0 ) res3 <- find_functions( ls("package:lazy.tools"), unlist=0, packages="lazy.tools" ) Print(res1,res2,res3) # funclist <- ls("package:lazy.tools") # res <- sort( unique( unlist( lapply( funclist, find_functions ) ) ) ) # res <- unique( unlist( lapply( funclist, find_functions, packages="lazy.tools" ) ) ) ## End(Not run)