powered by
Collapses a character vector of any length into a length 1 vector.
collapse(x, sep = "", width = Inf, last = "")
The character vector to collapse.
a character string to separate the terms. Not NA_character_.
NA_character_
The maximum string width before truncating with ....
...
String used to separate the last two items if x has at least 2 items.
x
collapse(glue("{1:10}")) # Wide values can be truncated collapse(glue("{1:10}"), width = 5) collapse(1:4, ",", last = " and ") #> 1, 2, 3 and 4
Run the code above in your browser using DataLab