tree_root: Get the root of the syntax tree

View source: R/tree.R

tree_rootR Documentation

Get the root of the syntax tree

Description

This function takes a tree created by tree_new() and returns the root node containing all subsequent nodes.

Usage

tree_root(x)

Arguments

x

A tree created by tree_new().

Value

A node corresponding to the root of the abstract syntax tree

Examples

src <- "x <- rnorm(100, mean = 2)
    any(duplicated(y))
    plot(x)
    any(duplicated(x))"

tree <- tree_new(src)
tree_root(tree)

astgrepr documentation built on June 8, 2025, 11:05 a.m.