melt_rows: Separate a collapsed column record into multiple rows.

Description Usage Arguments Details Value Examples

View source: R/melt.R

Description

Wrapper around tidyr::separate_rows(). Performs the operation for a given list of dividers (delimiters). Iterates through the set of possible dividers.

Usage

1
melt_rows(df, column, dividers = c("\\|"), trim_ws = TRUE)

Arguments

df

A DataFrame.

column

The name of the column/feature to perfom the separation on.

dividers

A vector of delimiters to

trim_ws

A boolean; determines if trailing white spaces (potentially generated by the split), are trimmed or not.

Details

If a feature/variable in a record contains multiple delimited values, this separates the values, placing each on in its own row (creating a new record). The transformation is similar to wide to long, but only (feature, record) having delimited values will create new rows.

Value

A DataFrame with the additional rows (as many as performed splits).

Examples

1
2
3
4
5
melt_rows(
  businesses[4:8, 3:4],
  "trading_name",
  dividers = c("\\|", " trading as ", "t/a", "\\/")
  )

xavier-gilbert/sabre documentation built on May 7, 2021, 12:40 p.m.