Skip to content

Select all binary columns

Description

Select all binary columns

Usage

cs__binary()

Value

A Polars selector

See Also

cs for the documentation on operators supported by Polars selectors.

Examples

library("polars")

df <- pl$select(
  a = charToRaw("hello"),
  b = pl$lit("world"),
  c = charToRaw("!"),
  d = pl$lit(":"),
)

# Select binary columns:
df$select(cs$binary())
#> shape: (1, 2)
#> ┌──────────┬────────┐
#> │ a        ┆ c      │
#> │ ---      ┆ ---    │
#> │ binary   ┆ binary │
#> ╞══════════╪════════╡
#> │ b"hello" ┆ b"!"   │
#> └──────────┴────────┘
# Select all columns except for those that are binary:
df$select(!cs$binary())
#> shape: (1, 2)
#> ┌───────┬─────┐
#> │ b     ┆ d   │
#> │ ---   ┆ --- │
#> │ str   ┆ str │
#> ╞═══════╪═════╡
#> │ world ┆ :   │
#> └───────┴─────┘