1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/glue.R, R/sql.R 3\name{glue_collapse} 4\alias{glue_collapse} 5\alias{glue_sql_collapse} 6\title{Collapse a character vector} 7\usage{ 8glue_collapse(x, sep = "", width = Inf, last = "") 9 10glue_sql_collapse(x, sep = "", width = Inf, last = "") 11} 12\arguments{ 13\item{x}{The character vector to collapse.} 14 15\item{sep}{a character string to separate the terms. Not 16 \code{\link[base]{NA_character_}}.} 17 18\item{width}{The maximum string width before truncating with \code{...}.} 19 20\item{last}{String used to separate the last two items if \code{x} has at least 212 items.} 22} 23\description{ 24\code{glue_collapse()} collapses a character vector of any length into a length 1 vector. 25\code{glue_sql_collapse()} does the same but returns a \verb{[DBI::SQL()]} 26object rather than a glue object. 27} 28\examples{ 29glue_collapse(glue("{1:10}")) 30 31# Wide values can be truncated 32glue_collapse(glue("{1:10}"), width = 5) 33 34glue_collapse(1:4, ", ", last = " and ") 35#> 1, 2, 3 and 4 36} 37