Skip to content

Evaluate whether any boolean value in a sub-list is true

Source code

Description

Evaluate whether any boolean value in a sub-list is true

Usage

<Expr>$list$any(..., ignore_nulls = TRUE)

Arguments

These dots are for future extensions and must be empty.
ignore_nulls If TRUE (default), ignore null values. If FALSE, Kleene logic is used to deal with nulls: if the column contains any null values and no TRUE values, the output is null.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(
  a = list(c(TRUE, TRUE), c(FALSE, TRUE), c(FALSE, FALSE), NA, c())
)
df$with_columns(any = pl$col("a")$list$any())
#> shape: (5, 2)
#> ┌────────────────┬───────┐
#> │ a              ┆ any   │
#> │ ---            ┆ ---   │
#> │ list[bool]     ┆ bool  │
#> ╞════════════════╪═══════╡
#> │ [true, true]   ┆ true  │
#> │ [false, true]  ┆ true  │
#> │ [false, false] ┆ false │
#> │ [null]         ┆ false │
#> │ null           ┆ null  │
#> └────────────────┴───────┘