str_subset_ops | R Documentation |
String subsetting operators.
The x %s><% ss
operator
gets a certain number of the first and last characters of every string in
character vector x
.
%sget%
is an alias for %s><%
.
The x %s<>% ss
operator
trims a certain number of the first and last characters of every string in
character vector x
.
%strim%
is an alias for %<>%
.
x %s><% ss
x %s<>% ss
x %sget% ss
x %strim% ss
x |
a character vector. |
ss |
a vector of length 2, or a matrix with 2 columns with |
These operators serve as a way to provide straight-forward string sub-setting.
Both operators return a character vector of the same length as x
.
The x %s><% ss
operator
gives a certain number of the first and last characters of each string in the input
character vector x
.
The x %s<>% ss
operator
removes a certain number of the first and last characters of each string in the input
character vector x
.
tinycodet_strings
x <- c(paste0(letters[1:13], collapse = ""),
paste0(letters[14:26], collapse = ""))
print(x)
ss <- c(2, 3)
x %s><% ss
x <- c(paste0(letters[1:13], collapse = ""),
paste0(letters[14:26], collapse = ""))
print(x)
ss <- c(1, 0)
x %s><% ss
x <- c(paste0(letters[1:13], collapse = ""),
paste0(letters[14:26], collapse = ""))
print(x)
ss <- c(2, 3)
x %s<>% ss
x <- c(paste0(letters[1:13], collapse = ""),
paste0(letters[14:26], collapse = ""))
print(x)
ss <- c(1, 0)
x %s<>% ss
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.