re2r (version 0.2.0)

re2_split: Split a string into pieces.

Description

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

Usage

re2_split(string, pattern, n = Inf, parallel = FALSE, grain_size = 10000,
  ...)

re2_split_fixed(string, pattern, n, parallel = FALSE, grain_size = 10000, ...)

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.

Examples

Run this code
# NOT RUN {
re2_split("yabba dabba doo", " ")
re2_split_fixed(c("yabba dabba doo", "a bc"), " ", 2)
# }

Run the code above in your browser using DataLab