expr_label

0th

Percentile

Turn an expression to a label.

expr_text() turns the expression into a single string; expr_label() formats it nicely for use in messages.

Usage
expr_label(expr)
expr_text(expr, width = 60L, nlines = Inf)
Arguments
expr
An expression to labellise.
width
Width of each line.
nlines
Maximum number of lines to extract.
Aliases
  • expr_label
  • expr_text
Examples
# To labellise a function argument, first capture it with
# substitute():
fn <- function(x) expr_label(substitute(x))
fn(x:y)

# Strings are encoded
expr_label("a\nb")

# Names and expressions are quoted with ``
expr_label(quote(x))
expr_label(quote(a + b + c))

# Long expressions are collapsed
expr_label(quote(foo({
  1 + 2
  print(x)
})))
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

Community examples

Looks like there are no examples yet.