Learn R Programming

rlang (version 0.1.6)

splice: Splice a list within a vector

Description

This adjective signals to functions taking dots that x should be spliced in a surrounding vector. Examples of functions that support such explicit splicing are ll(), chr(), etc. Generally, any functions taking dots with dots_list() or dots_splice() supports splicing.

Usage

splice(x)

is_spliced(x)

is_spliced_bare(x)

Arguments

x

A list to splice.

Details

Note that all functions supporting dots splicing also support the syntactic operator !!!. For tidy capture and tidy evaluation, this operator directly manipulates the calls (see quo() and quasiquotation). However manipulating the call is not appropriate when taking dots by value rather than by expression, because it is slow and the dots might contain large lists of data. For this reason we splice values rather than expressions when dots are not captured by expression. We do it in two steps: first mark the objects to be spliced, then splice the objects with flatten().

See Also

vector-construction

Examples

Run this code
# NOT RUN {
x <- list("a")

# It makes sense for ll() to accept lists literally, so it doesn't
# automatically splice them:
ll(x)

# But you can splice lists explicitly:
y <- splice(x)
ll(y)

# Or with the syntactic shortcut:
ll(!!! x)
# }

Run the code above in your browser using DataLab