child: Extract or Replace Descendant of an RStatic Object

Description Usage Arguments Details Value See Also Examples

View source: R/child.R

Description

This function extracts or replaces a descendant of the given node.

Usage

1
2
3
child(node, index)

child(node, index) <- value

Arguments

node

(ASTNode) The node from which to extract or replace the descendant.

index

(integer) The index of the descendant to extract or replace.

value

(ASTNode) The value to replace the descendant with.

Details

If index is a vector, the child function is called recursively so that descendants several levels below node are accessible.

Value

A single child node.

See Also

children to extract or replace all children at once.

Examples

1
2
3
4
code = quote_ast(mean(1, 2, 3 + x))
x = child(code, c(2, 3, 2, 2))

child(code, c(2, 3, 2, 2)) = Integer$new(4)

nick-ulle/ast documentation built on Oct. 18, 2019, 4:37 a.m.