glue_collapse | R Documentation |
glue_collapse()
collapses a character vector of any length into a length 1 vector.
glue_sql_collapse()
does the same but returns a [DBI::SQL()]
object rather than a glue object.
glue_collapse(x, sep = "", width = Inf, last = "")
glue_sql_collapse(x, sep = "", width = Inf, last = "")
x |
The character vector to collapse. |
sep |
a character string to separate the terms. Not
|
width |
The maximum string width before truncating with |
last |
String used to separate the last two items if |
Always returns a length-1 glue object, as created by as_glue()
.
glue_collapse(glue("{1:10}"))
# Wide values can be truncated
glue_collapse(glue("{1:10}"), width = 5)
glue_collapse(1:4, ", ", last = " and ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.