Split up a string into pieces.

Usage

re2_split(string, pattern, n = Inf, parallel = FALSE, grain_size = 1e+05, ...)
re2_split_fixed(string, pattern, n, parallel = FALSE, grain_size = 1e+05, ...)

Arguments

string
a character vector
pattern
a character vector or pre-compiled regular expressions
n
number of pieces to return. Default (Inf) for re2_split uses all possible split positions. For re2_split_fixed, if n is greater than the number of pieces, the result will be padded with empty strings.
parallel
use multithread
grain_size
a minimum chunk size for tuning the behavior of parallel algorithms
...
further arguments passed to re2

Value

For re2_split_fixed, a character matrix with n columns.

For re2_split, a list of character vectors.

Description

Split up a string into pieces. Vectorised over string and pattern.

Examples

re2_split("yabba dabba doo", " ")
[[1]] [1] "yabba" "dabba" "doo"
re2_split_fixed(c("yabba dabba doo", "a bc"), " ", 2)
[,1] [,2] [1,] "yabba" "dabba doo" [2,] "a" "bc"