Clip elements below minimum value
Description
Replace all values below a minimum value by this minimum value.
Usage
<Expr>$clip_min(min)
Arguments
min
|
Minimum value, Expr returning a numeric. |
Examples
library(polars)
pl$DataFrame(foo = c(-50L, 5L, NA_integer_, 50L))$
with_columns(clipped = pl$col("foo")$clip_min(1))
#> shape: (4, 2)
#> ┌──────┬─────────┐
#> │ foo ┆ clipped │
#> │ --- ┆ --- │
#> │ i32 ┆ i32 │
#> ╞══════╪═════════╡
#> │ -50 ┆ 1 │
#> │ 5 ┆ 5 │
#> │ null ┆ null │
#> │ 50 ┆ 50 │
#> └──────┴─────────┘