View source: R/string_concat.R
string_concat | R Documentation |
Concatenate strings together.
string_concat(a, b, ...) string_prefix(s, prefix) string_suffix(s, suffix) string_flag(s, flag, width, which = c('left', 'right', 'both')) string_flagv(s, ...)
a |
A string (character) vector. |
b |
A string (character) vector. |
... |
Parameters passed to |
s |
A string (character) vector. |
collapse |
A string by which to separate the elements of a vector. |
flag |
Character or number to append to a string. |
width |
Number of characters a string should be. |
which |
Side to flag a string. |
The %&%
operator acts similar to BASIC's &
, concatenating two elements together. For more general usage, use string_concat()
, whose optional inputs get passed to paste0()
.
string_prefix()
and its synonyms prefix a string to a vector, while string_suffix()
and its synonyms suffix a string to a vector.
string_flag()
is a scalar function that appends a character or number to a string if it does not meet a specified width.
string_flagv()
is a vectorized version of string_flag()
.
The synonym pattern of these functions are s_*()
and *()
(replace asterisks with prefix, suffix, and flag(v)).
Character vector.
https://github.com/robertschnitman/stringops
"a" %&% "b" string_prefix(rownames(mtcars), "A") string_suffix(rownames(mtcars), "Z") string_flag('123456789', '0', 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.