R: Format quosures for printing or labelling

quo_label {rlang} | R Documentation

## Format quosures for printing or labelling

### Description

- `quo_text()` and `quo_label()` are equivalent to `expr_text()`, `expr_label()`, etc, but they first squash all quosures with `quo_squash()` so they print more nicely.

- `quo_name()` squashes a quosure and transforms it into a simple string. It is suitable to give an unnamed quosure a default name, for instance a column name in a data frame.

### Usage

    quo_label(quo)

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

    quo_name(quo)

### Arguments

`quo` | A quosure or expression.
`width` | Width of each line.
`nlines` | Maximum number of lines to extract.

### See Also

`expr_label()`, `f_label()`

### Examples

    # Quosures can contain nested quosures:
    quo <- quo(foo(!! quo(bar)))
    quo

    # quo_squash() unwraps all quosures and returns a raw expression:
    quo_squash(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))

[Package rlang version 0.2.2 Index]