slice_char | R Documentation |
slice character vector
slice_char(x, from = x[1], to = x[length(x)], unique = FALSE)
x |
character vector |
from |
from |
to |
to |
unique |
remove the duplicated boundary characters |
sliced vector
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.