string_dup | R Documentation |
Miscellaneous string functions that don't quite fit into the other categories.
string_dup(s, times) string_insert(s, insert, position) string_split(s, split, ...) string_len(s) string_reverse(s) string_unique(s) string_sort(s, descend = FALSE)
s |
A string (character) vector. |
times |
The number of times to duplicate a string. |
insert |
The string to insert. |
position |
The position index to which to insert the string. |
split |
The character by which to split a string vector. |
... |
Parameters passed to |
descend |
Whether to sort in descending order ( |
string_dup()
acts the same as strrep()
: it repeats a string n number of times.
string_insert()
inserts a string at a specified position.
string_len()
acts the same as nchar()
: it counts the number of characters per vector element.
string_reverse()
reverses the characters in a string.
string_split()
acts the same as strsplit()
: it splits a string by a specified character.
string_unique()
obtains the distinct characters for each element in a vector.
string_sort()
arranges the letters in the character vector in order if descend = FALSE
(the default) and reverse order if descend = TRUE
.
The synonym pattern of these functions are s_*()
and *()
(insert, len, and reverse). For the former pattern, you can replace with split, unique, and sort, as well.
https://github.com/robertschnitman/stringops
string_dup(rownames(mtcars), 3) string_insert("abcd", "Z", 3) string_len(rownames(mtcars)) string_reverse(rownames(mtcars)) string_split(rownames(mtcars), " ") string_unique(rownames(mtcars)) string_sort(rownames(mtcars)) string_sort(rownames(mtcars), descend = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.