Learn R Programming

mark (version 0.8.1)

utils-paste: Paste combine

Description

Paste and combine

Usage

paste_c(x, y, collate = TRUE, sep = "")

paste_combine(..., collate = TRUE, sep = "")

collapse0(..., sep = "")

Value

A character vector

Arguments

x, y, ...

Vectors to paste and/or combine

collate

Logical; TRUE prints out combinations in order of the first vector elements then the next; otherwise reversed (see examples)

sep

A character string to separate terms

Examples

Run this code
x <- letters[1:5]
y <- 1:3
z <- month.abb[c(1, 12)]
paste_combine(x, y)
paste_combine(x, y, z)
paste_combine(x, y, z, sep = ".")
paste_combine(x, y, sep = "_")
paste_combine(x, y, collate = FALSE)
collapse0(list(1:3, letters[1:3]), 5:7, letters[5:7])
collapse0(1:3, letters[5:7], sep = "_")

Run the code above in your browser using DataLab