comma_join: Join a character vector together with commas

View source: R/sql_helpers.R

comma_joinR Documentation

Join a character vector together with commas

Description

Join a character vector together with commas

Usage

comma_join(
  s,
  leading_comma = FALSE,
  trailing_comma = FALSE,
  quote = FALSE,
  names_to_as = TRUE
)

Arguments

s

a character vector to be joined

leading_comma

should a leading comma be inserted?

trailing_comma

should a trailing comma be inserted?

quote

should the output be quoted? Default false.

names_to_as

if this is true and s is named, the names will be used as column identifiers. See examples. Defaults to true.

Value

a length-1 character vector

Examples

comma_join(letters)
comma_join(letters, leading_comma = TRUE)
comma_join(letters, quote = TRUE)

# named input
comma_join(c(avg_sales = "avg(sales)", "country"), names_to_as = TRUE)


colin-fraser/queries documentation built on April 14, 2022, 2:12 p.m.