stri_join {stringi} | R Documentation |
These are the stringi's equivalents of the built-in
paste
function.
stri_c
and stri_paste
are aliases for stri_join
.
Use whichever you want, they are exactly the same.
stri_join(..., sep = "", collapse = NULL, ignore_null = FALSE) stri_c(..., sep = "", collapse = NULL, ignore_null = FALSE) stri_paste(..., sep = "", collapse = NULL, ignore_null = FALSE)
... |
character vectors (or objects coercible to character vectors) which corresponding elements are to be concatenated |
sep |
a single string; separates terms |
collapse |
a single string or |
ignore_null |
a single logical value; if |
Vectorized over each vector in '...
'.
If collapse
is not NULL
, then the result will be a single string.
Otherwise, you will get a character vector of length equal
to the length of the longest argument.
If any of the arguments in '...
' is a vector of length 0
(not to be confused with vectors of empty strings)
and ignore_null=FALSE
, then
you will get a 0-length character vector in result.
If collapse
or sep
has length > 1, then only first string
will be used.
In case of any NA
in an input vector,
NA
is set to the corresponding element.
Note that this behavior is different from paste
,
which treats missing values as ordinary strings "NA"
.
Moreover, as usual in stringi, the resulting strings are
always in UTF-8.
Returns a character vector.
Other join: stri_dup
;
stri_flatten
stri_join(1:13, letters) stri_join(1:13, letters, sep='!') stri_join(1:13, letters, collapse='?') stri_join(1:13, letters, sep='!', collapse='?') stri_join(c('abc', '123', '\u0105\u0104'),'###', 1:5, sep='...') stri_join(c('abc', '123', '\u0105\u0104'),'###', 1:5, sep='...', collapse='?') do.call(stri_c, list(c("a", "b", "c"), c("1", "2"), sep='!')) do.call(stri_c, list(c("a", "b", "c"), c("1", "2"), sep='!', collapse='$'))