find_functions {lazy.tools}R Documentation

Find Functions used in a Function or Functions in a List of Function Names

Description

Find Functions used in a Function or Functions in a List of Function Names

Usage

find_functions(func, nonative = 1, noglobal = 0, sort = 1,
  packages = NULL, unlist = 1)

Arguments

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.
The functions included in those packages will not be printed.

unlist

= 0 to output the result in a list when func is a list or vector.

Details


This function requires "codetools" package.

Value

A character vector containing the function names.

References

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

Examples

## 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)


[Package lazy.tools version 0.1.3 Index]