Skip to content

Get the minimum value.

Source code

Description

Syntactic sugar for pl$col(…)$min().

Usage

pl$min(...)

Arguments

Characters indicating the column names, passed to pl$col(). See ?pl_col for details.

Value

Expr

See Also

  • \$min()
  • pl$min_horizontal()

Examples

library("polars")

df = pl$DataFrame(
  num_1 = c(1, 8, 3),
  num_2 = c(4, 5, 2),
  chr_1 = c("foo", "bar", "foo")
)

df$select(pl$min("num_1"))
#> shape: (1, 1)
#> ┌───────┐
#> │ num_1 │
#> │ ---   │
#> │ f64   │
#> ╞═══════╡
#> │ 1.0   │
#> └───────┘
# Get the minimum value of multiple columns.
df$select(pl$min(r"(^num_\d+$)"))
#> shape: (1, 2)
#> ┌───────┬───────┐
#> │ num_1 ┆ num_2 │
#> │ ---   ┆ ---   │
#> │ f64   ┆ f64   │
#> ╞═══════╪═══════╡
#> │ 1.0   ┆ 2.0   │
#> └───────┴───────┘
df$select(pl$min("num_1", "num_2"))
#> shape: (1, 2)
#> ┌───────┬───────┐
#> │ num_1 ┆ num_2 │
#> │ ---   ┆ ---   │
#> │ f64   ┆ f64   │
#> ╞═══════╪═══════╡
#> │ 1.0   ┆ 2.0   │
#> └───────┴───────┘