Skip to content

Compute the absolute values

Source code

Description

Compute the absolute values

Usage

<Expr>$abs()

Value

Expr

Examples

library(polars)

pl$DataFrame(a = -1:1)$
  with_columns(abs = pl$col("a")$abs())
#> shape: (3, 2)
#> ┌─────┬─────┐
#> │ a   ┆ abs │
#> │ --- ┆ --- │
#> │ i32 ┆ i32 │
#> ╞═════╪═════╡
#> │ -1  ┆ 1   │
#> │ 0   ┆ 0   │
#> │ 1   ┆ 1   │
#> └─────┴─────┘