Learn R Programming

stringfish (version 0.16.0)

sf_collapse: sf_collapse

Description

Pastes a series of strings together separated by the `collapse` parameter

Usage

sf_collapse(x, collapse)

Value

A single string with all values in `x` pasted together, separated by `collapse`.

Arguments

x

A character vector

collapse

A single string

Details

This works the same way as `paste0(x, collapse=collapse)`

See Also

paste0, paste

Examples

Run this code
if(getRversion() >= "3.5.0") {
x <- c("hello", "\\xe4\\xb8\\x96\\xe7\\x95\\x8c")
Encoding(x) <- "UTF-8"
sf_collapse(x, " ") # "hello world" in Japanese
sf_collapse(letters, "") # returns the alphabet
}

Run the code above in your browser using DataLab