View source: R/text_util_fun.R
collapse_chars | R Documentation |
x
into a single string.collapse_chars
converts multi-element character inputs x
into a single string of text (i.e., a character object of length 1),
separating its elements by sep
.
collapse_chars(x, sep = " ")
x |
A vector (required), typically a character vector. |
sep |
A character inserted as separator/delimiter
between elements when collapsing multi-element strings of |
As collapse_chars
is a wrapper around
paste(x, collapse = sep)
.
It preserves spaces within the elements of x
.
The separator sep
is only used when collapsing multi-element vectors
and inserted between elements.
See chars_to_text
for combining character vectors into text.
A character vector (of length 1).
chars_to_text
for combining character vectors into text;
text_to_chars
for splitting text into a vector of characters;
text_to_words
for splitting text into a vector of words;
strsplit
for splitting strings.
Other text objects and functions:
Umlaut
,
capitalize()
,
caseflip()
,
cclass
,
chars_to_text()
,
count_chars_words()
,
count_chars()
,
count_words()
,
invert_rules()
,
l33t_rul35
,
map_text_chars()
,
map_text_coord()
,
map_text_regex()
,
metachar
,
read_ascii()
,
text_to_chars()
,
text_to_sentences()
,
text_to_words()
,
transl33t()
,
words_to_text()
collapse_chars(c("Hello", "world", "!"))
collapse_chars(c("_", " _ ", " _ "), sep = "|") # preserves spaces
writeLines(collapse_chars(c("Hello", "world", "!"), sep = "\n"))
collapse_chars(1:3, sep = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.