Skip to contents

Counts columns when values within them are delimited.

Usage

count_delim(
  data,
  ...,
  delim = "|",
  sort = FALSE,
  name = NULL,
  trim = TRUE,
  convert = FALSE
)

Arguments

data

A data.frame.

...

<data-masking> Variables to group by.

delim

A delimiter to split elements within specified columns by (default: "|").

sort

If TRUE, will show the largest groups at the top.

name

The name of the new column in the output.

If omitted, it will default to n. If there's already a column called n, it will use nn. If there's a column called n and nn, it'll use nnn, and so on, adding ns until it gets a new name.

trim

Whether to trim start/end whitespace, as a boolean (default: TRUE).

convert

Whether to run utils::type.convert() with as.is = TRUE on new columns. This is useful if the de-concatenated columns are integer, numeric or logical. NOTE: "NA" strings will always be converted to NAs.