Skip to contents

Helper function for pretty printing vectors. Avoids repetitive paste0 code. If only one element does not add the separator at the end.

Usage

collapse(vector, collapse = " ")

Arguments

vector

Character vector.

collapse

A separator.

Value

character

Examples

collapse(letters, ", ")
#> [1] "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z"
collapse(letters[1], ", ")
#> [1] "a"