View source: R/freeVariables.R
getAllCalls | R Documentation |
This statically analyzes the R code and finds all calls both at the top-level in a script and in functions, in a directory of R files, etc.
One situation in which this can be useful is to identify
which packages need to be loaded/imported for a collection
of files, e.g., when creating a package from existing files,
or knowing which calls to link[base]{library}
are needed.
getAllSymbols
gets all the symbols in an R language object.
getAllCalls(x, ...)
getAllSymbols(expr, unique = TRUE, predicate = is.symbol)
x |
a character vector of file or directory names or the parsed code |
... |
arguments for methods |
expr |
the R code/language object |
unique |
a scalar logical value controlling whether all occurrences of symbols are returned
( |
predicate |
the function that determines whether the language object is a symbol
and one we want to capture. This can be more specific such as
|
A list of rstatic
Call
objects.
Duncan Temple Lang, Nick Ulle
rstatic
package https://github.com/nick-ulle/rstatic.git
findCallsTo
findLiterals
## Not run:
# calls by file in the directory R/
f = getAllCalls("R")
# flatten to a list of all calls
k = unlist(f, recursive = FALSE)
# What is the class
table(sapply(k, function(x) class(x$fn)[1]))
funs = sapply(k[sapply(k, function(x) is(x$fn, "Symbol"))], function(x) x$fn$value)
table(funs[ !(funs
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.