flatten_csv: Flatten list of strings of comma-separated elements

Description Usage Arguments Details Examples

Description

Flatten list of strings of comma-separated elements

Usage

1
flatten_csv(x, sep = ",", fixed = TRUE)

Arguments

x

Character vector of strings of separated elements

sep

Separator used to separate elements

fixed

If TRUE (default), separator is interpreted as a constant string, otherwise it is considered a regular expression in perl flavor

Details

The separator can also be an arbitrary perl regular expression in which case ‘fixed’ should be set to FALSE.

Examples

1
2
stopifnot(all(1:5 == flatten_csv(c("1,2", "3,4,5"))))
stopifnot(all(c("a", "b", "c", "d") == flatten_csv(c("a1b", "c23d"), sep = "\\d+", fixed = FALSE)))

cbaumbach/miscFun documentation built on May 13, 2019, 1:48 p.m.