Learn R Programming

librarian (version 1.8.1)

collapse_vec: Collapse a vector

Description

I use this internally for turning a vector of package names into a string.

Usage

collapse_vec(..., wrap = "'", collapse = ", ", unique = TRUE)

Arguments

...

(...) Vectors that will be concatenated and coerced to Character.

wrap

(Character) Placed at the left and right sides of each vector element.

collapse

(Character) Placed between each element of the original vector(s).

unique

(Logical) If TRUE, duplicate entries in ... will be removed.

Value

A string.

Examples

Run this code
# NOT RUN {
collapse_vec(month.abb)
#> [1] "'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'"
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab