Learn R Programming

rlang (version 0.1)

quo_expr: Splice a quosure and format it into string or label

Description

quo_expr() flattens all quosures within an expression. I.e., it turns ~foo(~bar(), ~baz) to foo(bar(), baz). quo_text() and quo_label() are equivalent to f_text(), expr_label(), etc, but they first splice their argument using quo_expr(). quo_name() transforms a quoted symbol to a string. It adds a bit more intent and type checking than simply calling quo_text() on the quoted symbol (which will work but won't return an error if not a symbol).

Usage

quo_expr(quo, warn = FALSE)

quo_label(quo)

quo_text(quo, width = 60L, nlines = Inf)

quo_name(quo)

Arguments

quo

A quosure or expression.

warn

Whether to warn if the quosure contains other quosures (those will be collapsed).

width

Width of each line.

nlines

Maximum number of lines to extract.

See Also

expr_label(), f_label()

Examples

Run this code
# NOT RUN {
quo <- quo(foo(!! quo(bar)))
quo

# quo_expr() unwraps all quosures and returns a raw expression:
quo_expr(quo)

# This is used by quo_text() and quo_label():
quo_text(quo)

# Compare to the unwrapped expression:
expr_text(quo)

# quo_name() is helpful when you need really short labels:
quo_name(quo(sym))
quo_name(quo(!! sym))
# }

Run the code above in your browser using DataLab