Format the expression as a tree
Description
Format the expression as a tree
Usage
<Expr>$meta$tree_format()
Value
A character vector
Examples
library("polars")
my_expr <- (pl$col("foo") * pl$col("bar"))$sum()$over(pl$col("ham")) / 2
my_expr$meta$tree_format() |>
cat()
#> 0 1 2 3
#> ┌──────────────────────────────────────────────────────────
#> │
#> │ ╭───────────╮
#> 0 │ │ binary: / │
#> │ ╰─────┬┬────╯
#> │ ││
#> │ │╰────────────╮
#> │ │ │
#> │ ╭────┴─────╮ ╭───┴────╮
#> 1 │ │ lit(2.0) │ │ window │
#> │ ╰──────────╯ ╰───┬┬───╯
#> │ ││
#> │ │╰─────────────╮
#> │ │ │
#> │ ╭────┴─────╮ ╭──┴──╮
#> 2 │ │ col(ham) │ │ sum │
#> │ ╰──────────╯ ╰──┬──╯
#> │ │
#> │ │
#> │ │
#> │ ╭─────┴─────╮
#> 3 │ │ binary: * │
#> │ ╰─────┬┬────╯
#> │ ││
#> │ │╰────────────╮
#> │ │ │
#> │ ╭────┴─────╮ ╭────┴─────╮
#> 4 │ │ col(bar) │ │ col(foo) │
#> │ ╰──────────╯ ╰──────────╯