Skip to contents

Capture the expressions supplied in ... without evaluating them. Use dots() when the expressions should remain as language objects. Use dots_char() when the expressions should be returned as text.

Usage

dots(..., .names = TRUE, .duplicate_names = "warn")

dots_char(..., .names = TRUE, .duplicate_names = "warn")

Arguments

...

Expressions to capture.

.names

(Scalar logical: TRUE)
Whether to fill missing names with deparsed expressions. Explicit names are always preserved.

.duplicate_names

(Scalar character: "warn"; c("ignore", "warn", "stop"))
Action to take when duplicate names are found. Values are matched exactly. Duplicate names are checked after missing names have been filled. Repeated expressions in ... are allowed. The duplicate-name policy is applied only if .names = TRUE.

Value

An object with one element for each expression in .... dots() returns a list of unevaluated expressions. dots_char() returns a character vector of deparsed expressions. If .names = TRUE, missing names are filled with the deparsed expression. If .names = FALSE, missing names are left missing. Empty ... returns list() from dots() and character(0) from dots_char().

Examples

#----------------------------------------------------------------------------
# dots() examples
#----------------------------------------------------------------------------
library(bkbase)

a <- 1:5

dots(a, 6:10, x = 3)
#> $a
#> a
#> 
#> $`6:10`
#> 6:10
#> 
#> $x
#> [1] 3
#> 
dots_char(a, 6:10, x = 3)
#>      a   6:10      x 
#>    "a" "6:10"    "3" 
dots(a, 6:10, x = 3, .names = FALSE)
#> [[1]]
#> a
#> 
#> [[2]]
#> 6:10
#> 
#> $x
#> [1] 3
#>