qc: Quoting version of c() array concatenate.

Description Usage Arguments Details Value See Also Examples

View source: R/qc.R

Description

The qc() function is intended to help quote user inputs.

Usage

1
qc(..., .wrapr_private_var_env = parent.frame())

Arguments

...

items to place into an array

.wrapr_private_var_env

environment to evaluate in

Details

qc() a convenience function allowing the user to elide excess quotation marks. It quotes its arguments instead of evaluating them, except in the case of a nested call to qc() or c(). Please see the examples for typical uses both for named and un-named character vectors. Taken from library wrapr, by John Mount and Nina Zymel.

qc() uses bquote() .() quasiquotation escaping notation.

Value

quoted array of character items

See Also

bquote

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
a <- "x"

qc(a) # returns the string "a" (not "x")

qc(.(a)) # returns the string "x" (not "a")

qc(.(a) := a) # returns c("x" = "a")

qc("a") # return the string "a" (not "\"a\"")

qc(sin(x))  # returns the string "sin(x)"

qc(a, qc(b, c)) # returns c("a", "b", "c")

qc(a, c("b", "c")) # returns c("a", "b", "c")

qc(x=a, qc(y=b, z=c)) # returns c(x="a", y="b", z="c")

qc('x'='a', qc('y'='b', 'z'='c')) # returns c(x="a", y="b", z="c")

c(a = c(a="1", b="2")) # returns c(a.a = "1", a.b = "2")
qc(a = c(a=1, b=2)) # returns c(a.a = "1", a.b = "2")
qc(a := c(a=1, b=2)) # returns c(a.a = "1", a.b = "2")

emilBeBri/dttools documentation built on April 21, 2021, 5:44 a.m.