EVOLUTION-MANAGER
Edit File: as_label.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Create a default name for an R object</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for as_label {rlang}"><tr><td>as_label {rlang}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create a default name for an R object</h2> <h3>Description</h3> <p><code>as_label()</code> transforms R objects into a short, human-readable description. You can use labels to: </p> <ul> <li><p> Display an object in a concise way, for example to labellise axes in a graphical plot. </p> </li> <li><p> Give default names to columns in a data frame. In this case, labelling is the first step before name repair. </p> </li></ul> <p>See also <code><a href="as_name.html">as_name()</a></code> for transforming symbols back to a string. Unlike <code>as_label()</code>, <code>as_name()</code> is a well defined operation that guarantees the roundtrip symbol -> string -> symbol. </p> <p>In general, if you don't know for sure what kind of object you're dealing with (a call, a symbol, an unquoted constant), use <code>as_label()</code> and make no assumption about the resulting string. If you know you have a symbol and need the name of the object it refers to, use <code><a href="as_name.html">as_name()</a></code>. For instance, use <code>as_label()</code> with objects captured with <code>enquo()</code> and <code>as_name()</code> with symbols captured with <code>ensym()</code>. </p> <h3>Usage</h3> <pre> as_label(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object.</p> </td></tr> </table> <h3>Transformation to string</h3> <ul> <li><p> Quosures are <a href="quo_squash.html">squashed</a> before being labelled. </p> </li> <li><p> Symbols are transformed to string with <code>as_string()</code>. </p> </li> <li><p> Calls are abbreviated. </p> </li> <li><p> Numbers are represented as such. </p> </li> <li><p> Other constants are represented by their type, such as <code style="white-space: pre;"><dbl></code> or <code style="white-space: pre;"><data.frame></code>. </p> </li></ul> <h3>See Also</h3> <p><code><a href="as_name.html">as_name()</a></code> for transforming symbols back to a string deterministically. </p> <h3>Examples</h3> <pre> # as_label() is useful with quoted expressions: as_label(expr(foo(bar))) as_label(expr(foobar)) # It works with any R object. This is also useful for quoted # arguments because the user might unquote constant objects: as_label(1:3) as_label(base::list) </pre> <hr /><div style="text-align: center;">[Package <em>rlang</em> version 1.0.6 <a href="00Index.html">Index</a>]</div> </body></html>