Separates string data on whitespace and separating symbols into an array.

bc(s, ..., sep_symbols = ",|", strict = TRUE)

Arguments

s

string to parse

...

force later arguments to be set by name

sep_symbols

characters to consider separators

strict

logical, if TRUE throw exception on confusing input

Value

vector of values

Details

Can throw exception on lack of explicit value separators, example: bc('"a""b"') and non-matching portions. Whitespace is normalized to spaces. Suggested by Emil Erik Pula Bellamy Begtrup-Bright https://github.com/WinVector/wrapr/issues/12.

Examples

bc('1 2 "c", d') # returns c("1", "2", "c", "d")
#> [1] "1" "2" "c" "d"
bc('1 2 3') # returns c(1, 2, 3)
#> [1] 1 2 3
bc('1 2 "3"') # returns c("1", "2", "3")
#> [1] "1" "2" "3"
bc('1,2|3.4') # returns c(1, 2, 3.4)
#> [1] 1.0 2.0 3.4