Learn R Programming

chk (version 0.11.0)

p: Concatenate Strings

Description

A wrapper on base::paste().

Usage

p(..., sep = " ", collapse = NULL, recycle0 = FALSE)

p0(..., collapse = NULL, recycle0 = FALSE)

Value

A character vector.

Arguments

...

one or more R objects, to be converted to character vectors.

sep

a character string to separate the terms. Not NA_character_.

collapse

an optional character string to separate the results. Not NA_character_. When collapse is a string, the result is always a string (character of length 1).

recycle0

logical indicating if zero-length character arguments should result in the zero-length character(0). Note that when collapse is a string, recycle0 does not recycle to zero-length, but to "".

Functions

Examples

Run this code
p("a", "b")
p(c("a", "b"), collapse = " ")
p("a", character(0))
p("a", character(0), recycle0 = TRUE)
p0("a", "b")
p0(c("a", "b"), collapse = "")
p0("a", character(0))
p0("a", character(0), recycle0 = TRUE)

Run the code above in your browser using DataLab