Skip to contents

A wrapper on base::paste().

Usage

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

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

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 "".

Value

A character vector.

Functions

Examples

p("a", "b")
#> [1] "a b"
p(c("a", "b"), collapse = " ")
#> [1] "a b"
p("a", character(0))
#> [1] "a "
p("a", character(0), recycle0 = TRUE)
#> character(0)
p0("a", "b")
#> [1] "ab"
p0(c("a", "b"), collapse = "")
#> [1] "ab"
p0("a", character(0))
#> [1] "a"
p0("a", character(0), recycle0 = TRUE)
#> character(0)