StrSplit.Rd
Split the elements of a character vector x into substrings according to the matches to substring split within them.
This is a verbatim copy of the base R function strsplit
, but with a split default of ""
and returning a vector instead of a list, when x had the length 1.
StrSplit(x, split = "", fixed = FALSE, perl = FALSE, useBytes = FALSE)
character vector, each element of which is to be split. Other inputs, including a factor, will give an error.
character vector (or object which can be coerced to such)
containing regular expression(s) (unless fixed = TRUE
)
to use for splitting. If empty matches occur, in particular if
split
has length 0, x
is split into single characters.
If split
has length greater than 1, it is re-cycled along
x
.
logical. If TRUE
match split
exactly, otherwise
use regular expressions. Has priority over perl
.
logical. Should Perl-compatible regexps be used?
logical. If TRUE
the matching is done
byte-by-byte rather than character-by-character, and inputs with
marked encodings are not converted. This is forced (with a warning)
if any input is found which is marked as "bytes"
(see Encoding
).
See strsplit
for the details.
A list of the same length as x
, the i
-th element of which
contains the vector of splits of x[i]
.
If the length x was 1 a vecotor with the splits will be returned.