Skip to content

Vertically concatenate the string values in the column to a single string value.

Source code

Description

Vertically concatenate the string values in the column to a single string value.

Usage

<Expr>$str$join(delimiter = "", ..., ignore_nulls = TRUE)

Arguments

delimiter The delimiter to insert between consecutive string values.
Ignored.
ignore_nulls Ignore null values (default). If FALSE, null values will be propagated: if the column contains any null values, the output is null.

Value

Expr of String concatenated

Examples

library("polars")

# concatenate a Series of strings to a single string
df = pl$DataFrame(foo = c(1, NA, 2))

df$select(pl$col("foo")$str$join("-"))
#> shape: (1, 1)
#> ┌─────────┐
#> │ foo     │
#> │ ---     │
#> │ str     │
#> ╞═════════╡
#> │ 1.0-2.0 │
#> └─────────┘
df$select(pl$col("foo")$str$join("-", ignore_nulls = FALSE))
#> shape: (1, 1)
#> ┌──────┐
#> │ foo  │
#> │ ---  │
#> │ str  │
#> ╞══════╡
#> │ null │
#> └──────┘