slice_char {baizer} | R Documentation |
slice character vector
Description
slice character vector
Usage
slice_char(x, from = x[1], to = x[length(x)], unique = FALSE)
Arguments
x |
character vector |
from |
from |
to |
to |
unique |
remove the duplicated boundary characters |
Value
sliced vector
Examples
x <- c("A", "B", "C", "D", "E")
slice_char(x, "A", "D")
slice_char(x, "D", "A")
x <- c("A", "B", "C", "C", "A", "D", "D", "E", "A")
slice_char(x, "B", "E")
# duplicated element as boundary will throw an error
# slice_char(x, 'A', 'E')
# unique=TRUE to remove the duplicated boundary characters
slice_char(x, "A", "E", unique = TRUE)
[Package baizer version 0.8.0 Index]