stri_join: Concatenate Character Vectors

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
3
4
5
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

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.

Value

Returns a character vector.

See Also

Other join: stri_dup; stri_flatten

Examples

1
2
3
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='?')

Example output

 [1] "1a"  "2b"  "3c"  "4d"  "5e"  "6f"  "7g"  "8h"  "9i"  "10j" "11k" "12l"
[13] "13m" "1n"  "2o"  "3p"  "4q"  "5r"  "6s"  "7t"  "8u"  "9v"  "10w" "11x"
[25] "12y" "13z"
[1] "abc...###...1"          "123...###...2"          "<U+0105><U+0104>...###...3"
[4] "abc...###...4"          "123...###...5"         
Warning message:
In stri_join(c("abc", "123", "<U+0105><U+0104>"), "###", 1:5, sep = "...") :
  longer object length is not a multiple of shorter object length
[1] "abc...###...1?123...###...2?<U+0105><U+0104>...###...3?abc...###...4?123...###...5"
Warning message:
In stri_join(c("abc", "123", "<U+0105><U+0104>"), "###", 1:5, sep = "...",  :
  longer object length is not a multiple of shorter object length

stringi documentation built on May 2, 2019, 4:54 p.m.