format_chr_with_quotes: Format each entry in a character vector via quoting; special...

View source: R/utils.R

format_chr_with_quotesR Documentation

Format each entry in a character vector via quoting; special replacement for length 0

Description

Performs no escaping within the strings; if you want something that reader could copy-paste to debug, look into format_deparse (note that this collapses into a single string).

Usage

format_chr_with_quotes(x, empty = "*none*")

Arguments

x

chr; e.g., colnames of some data frame

empty

chr, likely string; what should be output if x is of length 0?

Value

chr; same length as x if x had nonzero length; value of empty otherwise

Examples

cli::cli_inform('{epiprocess:::format_chr_with_quotes("x")}')
cli::cli_inform('{epiprocess:::format_chr_with_quotes(c("x","y"))}')
nms <- c("x", "\"Total Cases\"")
cli::cli_inform("{epiprocess:::format_chr_with_quotes(nms)}")
cli::cli_inform("{epiprocess:::format_chr_with_quotes(character())}")


cmu-delphi/epiprocess documentation built on April 12, 2025, 12:51 p.m.