stri_join: Concatenate Character Vectors

View source: R/join.R

stri_joinR Documentation

Concatenate Character Vectors


These are the stringi's equivalents of the built-in paste function. stri_c and stri_paste are aliases for stri_join.


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) whose corresponding elements are to be concatenated


a single string; separates terms


a single string or NULL; an optional results separator


a single logical value; if TRUE, then empty vectors provided via ... are silently ignored


Vectorized over each atomic vector in '...'.

Unless collapse is NULL, the result will be a single string. Otherwise, you 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 is FALSE, then you will get a 0-length character vector in result.

If collapse or sep has length greater than 1, then only the first string will be used.

In case where there are missing values in any of the input vectors, NA is set to the corresponding element. Note that this behavior is different from paste, which treats missing values as ordinary strings like 'NA'. Moreover, as usual in stringi, the resulting strings are always in UTF-8.


Returns a character vector.


Marek Gagolewski and other contributors

See Also

The official online manual of stringi at

Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, doi: 10.18637/jss.v103.i02

Other join: %s+%(), stri_dup(), stri_flatten(), stri_join_list()


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', 'xyz'),'###', 1:6, sep=',')
stri_join(c('abc', '123', 'xyz'),'###', 1:6, sep=',', collapse='; ')

stringi documentation built on Jan. 11, 2023, 5:18 p.m.

Related to stri_join in stringi...