separate_longer_delim: Split a string into rows

View source: R/separate_longer_delim.R

separate_longer_delimR Documentation

Split a string into rows

Description

If a column contains observations with multiple delimited values, separate them each into their own row.

Usage

separate_longer_delim(.df, cols, delim, ...)

Arguments

.df

A data.frame or data.table

cols

Columns to separate

delim

Separator delimiting collapsed values

...

These dots are for future extensions and must be empty.

Examples

df <- data.table(
  x = 1:3,
  y = c("a", "d,e,f", "g,h"),
  z = c("1", "2,3,4", "5,6")
)

df %>%
  separate_longer_delim(c(y, z), ",")

mtfairbanks/gdt documentation built on April 12, 2024, 6:51 p.m.