
Last chance! 50% off unlimited learning
Sale ends in
Joins the elements of a character vector into one string.
stri_flatten(str, collapse = "", na_empty = FALSE, omit_empty = FALSE)
a vector of strings to be coerced to character
a single string denoting the separator
single logical value; should missing values
in str
be treated as empty strings?
single logical value; should missing values
in str
be omitted?
Returns a single string, i.e., a character vector of length 1.
The stri_flatten(str, collapse='XXX')
call
is equivalent to paste(str, collapse='XXX', sep="")
.
If you wish to use some more fancy (e.g. differing)
separators between flattened strings,
call stri_join(str, separators, collapse='')
.
If str
is not empty, then a single string is returned.
If collapse
has length > 1, then only first string
will be used.
Other join: stri_dup
,
stri_join_list
, stri_join
# NOT RUN {
stri_flatten(LETTERS)
stri_flatten(LETTERS, collapse=",")
stri_flatten(c('abc', '123', '\u0105\u0104'))
stri_flatten(stri_dup(letters[1:6],1:3))
stri_flatten(c(NA, "", "A", "", "B", NA, "C"), collapse=",", na_empty=TRUE, omit_empty=TRUE)
# }
Run the code above in your browser using DataLab