bc: Blank Concatenate. Parse argument as a vector of values...

Description Usage Arguments Details Value See Also Examples

View source: R/bc.R

Description

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

Usage

1
bc(s, ..., sep_symbols = ",|", strict = TRUE, convert = 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

convert

logical, if TRUE try to convert from string type to other types

Details

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

Value

vector of values

See Also

qc, qe, qae, bquote, sx

Examples

1
2
3
4
5
bc('1 2 "c", d') # returns c("1", "2", "c", "d")
bc('1 2 3') # returns c(1, 2, 3)
bc('1 2 "3"') # returns c("1", "2", "3")
bc('1,2|3.4') # returns c(1, 2, 3.4)
bc('01 02', convert=FALSE) # returns c("01", "02")

wrapr documentation built on Jan. 27, 2022, 1:14 a.m.