Learn R Programming

stringi (version 0.1-25)

stri_join: Concatenate Character Vectors

Description

This is the stringi's equivalents of the built-in paste function.

Usage

stri_join(..., sep = "", collapse = NULL)

stri_c(..., sep = "", collapse = NULL)

stri_paste(..., sep = "", collapse = NULL)

Arguments

...
character vectors which corresponding elements should be concatenated
sep
single string; separates terms
collapse
single string; separates the results

Value

  • Returns a character vector.

Details

stri_c and stri_paste are aliases for stri_join. Use whichever you want, they are equivalent.

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), 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, NA is set to the corresponding element.

See Also

Other join: stri_dup; stri_flatten

Examples

Run this code
stri_join(1:13, letters)
stri_join(c('abc','123','\u0105\u0104'),'###', 1:5, sep='...')
stri_join(c('abc','123','\u0105\u0104'),'###', 1:5, sep='...', collapse='?')

Run the code above in your browser using DataLab