split_match {textshape} | R Documentation |
Split a Vector By Split Points
Description
split_match
- Splits a vector
into a list of vectors based on
split points.
split_match_regex
- split_match
with regex = TRUE
.
Usage
split_match(x, split = "", include = FALSE, regex = FALSE, ...)
split_match_regex(x, split = "", include = FALSE, ...)
Arguments
x |
A vector with split points. |
split |
A vector of places (elements) to split on or a regular
expression if |
include |
An integer of |
regex |
logical. If |
... |
Value
Returns a list of vectors.
Author(s)
Matthew Flickinger and Tyler Rinker <tyler.rinker@gmail.com>.
References
https://stackoverflow.com/a/24319217/1000343
Examples
set.seed(15)
x <- sample(c("", LETTERS[1:10]), 25, TRUE, prob=c(.2, rep(.08, 10)))
split_match(x)
split_match(x, "C")
split_match(x, c("", "C"))
split_match(x, include = 0)
split_match(x, include = 1)
split_match(x, include = 2)
set.seed(15)
x <- sample(1:11, 25, TRUE, prob=c(.2, rep(.08, 10)))
split_match(x, 1)
[Package textshape version 1.7.5 Index]