stri_flatten | R Documentation |
Joins the elements of a character vector into one string.
stri_flatten(str, collapse = "", na_empty = FALSE, omit_empty = FALSE)
str |
a vector of strings to be coerced to character |
collapse |
a single string denoting the separator |
na_empty |
single logical value; should missing values
in |
omit_empty |
single logical value; should empty strings
in |
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 the first string
will be used.
Returns a single string, i.e., a character vector of length 1.
Marek Gagolewski and other contributors
The official online manual of stringi at https://stringi.gagolewski.com/
Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v103.i02")}
Other join:
%s+%()
,
stri_dup()
,
stri_join_list()
,
stri_join()
stri_flatten(LETTERS)
stri_flatten(LETTERS, collapse=',')
stri_flatten(stri_dup(letters[1:6], 1:3))
stri_flatten(c(NA, '', 'A', '', 'B', NA, 'C'), collapse=',', na_empty=TRUE, omit_empty=TRUE)
stri_flatten(c(NA, '', 'A', '', 'B', NA, 'C'), collapse=',', na_empty=NA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.