find_nodes | R Documentation |
This function traverses the given RStatic object and returns a list of all descendants that satisfy the given test function.
find_nodes(node, test, ..., recursive = TRUE, initial = list())
node |
(ASTNode) The RStatic object to search. |
test |
(function) The test function, which should accept an rstatic object to check as its first argument and return a scalar logical. |
... |
Additional arguments to the test function. |
recursive |
(logical) Search recursively in matching nodes? |
initial |
(list) Initial list of matching nodes. |
A list of matching nodes.
find_node_indices()
, replace_nodes()
ast = quote_ast(
function(x, y) {
x = x + y
function() x
})
find_nodes(ast, is, "Function")
find_nodes(ast, is_symbol, "x")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.