Skip to content

all

Either return an expression representing all columns, or evaluate a bitwise AND operation

Description

If no arguments are passed, this function is syntactic sugar for col(“*“). Otherwise, this function is syntactic sugar for col(names)$all().

Usage

pl$all(..., ignore_nulls = TRUE)

Arguments

Name(s) of the columns to use in the aggregation.
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 = c(TRUE, FALSE, TRUE),
  b = c(FALSE, FALSE, FALSE)
)

# Selecting all columns
df$select(pl$all()$sum())
#> shape: (1, 2)
#> ┌─────┬─────┐
#> │ a   ┆ b   │
#> │ --- ┆ --- │
#> │ u32 ┆ u32 │
#> ╞═════╪═════╡
#> │ 2   ┆ 0   │
#> └─────┴─────┘
# Evaluate bitwise AND for a column.
df$select(pl$all("a"))
#> shape: (1, 1)
#> ┌───────┐
#> │ a     │
#> │ ---   │
#> │ bool  │
#> ╞═══════╡
#> │ false │
#> └───────┘