Skip to content

Format the expression as a tree

Source code

Description

Format the expression as a tree

Usage

<Expr>$meta$tree_format(..., as_dot = FALSE, schema = NULL)

Arguments

These dots are for future extensions and must be empty.
as_dot [Experimental] If TRUE, show the dot syntax that can be used in other packages, such as DiagrammeR.
schema An optional schema. Must be NULL or a named list of DataType.

Value

A string, either with the tree itself (if as_dot = FALSE) or with the corresponding GraphViz code (if as_dot = TRUE).

Examples

library("polars")

my_expr <- (pl$col("foo") * pl$col("bar"))$sum()$over(pl$col("ham")) / 2
cat(my_expr$meta$tree_format())

# This output can be displayed with DiagrammeR for instance
graph <- my_expr$meta$tree_format(as_dot = TRUE)
DiagrammeR::grViz(graph)