words_to_text {ds4psy} | R Documentation |
Paste or collapse words x
into a text.
Description
words_to_text
pastes or collapses
a character string x
into a single text string.
Usage
words_to_text(x, collapse = " ")
Arguments
x |
A string of text (required), typically a character vector. |
collapse |
A character string to separate the elements of |
Details
words_to_text
is essentially identical to
collapse_chars
.
Internally, both functions are wrappers around
paste
with a collapse
argument.
Value
A text (as a collapsed character vector).
See Also
text_to_words
for splitting a text into its words;
text_to_sentences
for splitting text into a vector of sentences;
text_to_chars
for splitting text into a vector of characters;
count_words
for counting the frequency of words;
collapse_chars
for collapsing character vectors;
strsplit
for splitting strings.
Other text objects and functions:
Umlaut
,
capitalize()
,
caseflip()
,
cclass
,
chars_to_text()
,
collapse_chars()
,
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()
Examples
s <- c("Hello world!", "A 1st sentence.", "A 2nd sentence.", "The end.")
words_to_text(s)
cat(words_to_text(s, collapse = "\n"))