Skip to content

Get the column name that this expression would produce

Source code

Description

It may not always be possible to determine the output name as that can depend on the schema of the context; in that case this will raise an error if raise_if_undetermined is TRUE (the default), or return NA otherwise.

Usage

<Expr>$meta$output_name(..., raise_if_undetermined = TRUE)

Arguments

Ignored.
raise_if_undetermined If TRUE (default), raise an error if the output name cannot be determined. Otherwise, return NA.

Value

A character vector

Examples

library("polars")

e = pl$col("foo") * pl$col("bar")
e$meta$output_name()
#> [1] "foo"
e_filter = pl$col("foo")$filter(pl$col("bar") == 13)
e_filter$meta$output_name()
#> [1] "foo"
e_sum_over = pl$sum("foo")$over("groups")
e_sum_over$meta$output_name()
#> [1] "foo"
e_sum_slice = pl$sum("foo")$slice(pl$len() - 10, pl$col("bar"))
e_sum_slice$meta$output_name()
#> [1] "foo"
pl$len()$meta$output_name()
#> [1] "len"
pl$col("*")$meta$output_name(raise_if_undetermined = FALSE)
#> [1] NA