Learn R Programming

soundcorrs (version 0.4.0)

collapse: Paste and collapse.

Description

Concatenate strings, possibly interspersing them with another string.

Usage

collapse(..., inter = "")

Arguments

...

Objects to be pasted and collapsed.

inter

[character] String with which to intersperse the result. Defaults to an empty string.

Value

[character] The collapsed string.

Details

paste0(..., collapse="") takes a little more space than collapse(...), though if the result is to be interspersed with something, the difference becomes merely one character: paste0(..., collapse="_") vs collapse(..., inter="_").

Examples

Run this code
# NOT RUN {
tmp <- c ("i", "am", "a", "sample", "vector")
identical (soundcorrs:::collapse(tmp), paste0(tmp,collapse=""))
# }

Run the code above in your browser using DataLab