add_quotes {chronicle}R Documentation

Adds additional quotations to character values

Description

This is useful when assembling functions calls, where you specify parameter names and character values at the same time.

Usage

add_quotes(x, except = NULL, single_quote = TRUE, collapse = NULL)

Arguments

x

List or named vector

except

Vector specifying the names of the elements that should not be enquoted.

single_quote

Use single quotes (') instead of double quotes ("). Default is TRUE.

collapse

If not NULL, collapse the values into a single vector using this value as the separator. Default is NULL.

Value

The list or named vector, with additional quotes around the appropriate values

Examples

params = list(a = TRUE, b = FALSE, c = 'ABC', d = 15)
add_quotes(params)
add_quotes(params, except = 'c')

[Package chronicle version 0.3 Index]