Description Usage Arguments Value See Also Examples
sub_string
extracts substrings under code point-based index ranges provided. sub_string<-
allows to substitute parts of a string with given strings.
1 2 3 | sub_string(string, from = 1L, to = -1L)
sub_string(string, from = 1L, to = -1L) <- value
|
string |
input character vector. |
from |
an integer vector or a two-column matrix. |
to |
an integer vector. |
value |
replacement string |
A character vector of substring from start
to end
(inclusive). Will be length of longest input argument.
The underlying implementation in stri_sub
1 2 3 4 5 6 7 8 9 10 | sub_string("test", 1, 2)
x <- "ABC"
(sub_string(x, 1, 1) <- "A")
x
(sub_string(x, -2, -2) <- "GHIJ")
x
(sub_string(x, 2, -2) <- "")
x
|
[1] "te"
[1] "A"
[1] "ABC"
[1] "GHIJ"
[1] "AGHIJC"
[1] ""
[1] "AC"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.