EVOLUTION-MANAGER
Edit File: new_pillar_shaft.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: Constructor for column data</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 new_pillar_shaft {pillar}"><tr><td>new_pillar_shaft {pillar}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Constructor for column data</h2> <h3>Description</h3> <p>The <code>new_pillar_shaft()</code> constructor creates objects of the <code>"pillar_shaft"</code> class. This is a virtual or abstract class, you must specify the <code>class</code> argument. By convention, this should be a string that starts with <code>"pillar_shaft_"</code>. See <code>vignette("extending", package = "tibble")</code> for usage examples. </p> <p>This method accepts a vector of arbitrary length and is expected to return an S3 object with the following properties: </p> <ul> <li><p> It has an attribute <code>"width"</code> </p> </li> <li><p> It can have an attribute <code>"min_width"</code>, if missing, <code>"width"</code> is used </p> </li> <li><p> It must implement a method <code>format(x, width, ...)</code> that can be called with any value between <code>min_width</code> and <code>width</code> </p> </li> <li><p> This method must return an object that inherits from <code>character</code> and has attributes <code>"align"</code> (with supported values <code>"left"</code>, <code>"right"</code>, and <code>"center"</code>) and <code>"width"</code> </p> </li></ul> <p>The function <code><a href="new_pillar_shaft.html">new_pillar_shaft()</a></code> returns such an object, and also correctly formats <code>NA</code> values. In many cases, the implementation of <code>pillar_shaft.your_class_name()</code> will format the data as a character vector (using color for emphasis) and simply call <code>new_pillar_shaft()</code>. See <code>pillar:::pillar_shaft.numeric</code> for a code that allows changing the display depending on the available width. </p> <p><code>new_pillar_shaft_simple()</code> provides an implementation of the <code>pillar_shaft</code> class suitable for output that has a fixed formatting, which will be truncated with a continuation character (ellipsis or <code>~</code>) if it doesn't fit the available width. By default, the required width is computed from the natural width of the <code>formatted</code> argument. </p> <h3>Usage</h3> <pre> new_pillar_shaft( x, ..., width = NULL, min_width = width, type_sum = NULL, class = NULL, subclass = NULL ) new_pillar_shaft_simple( formatted, ..., width = NULL, align = "left", min_width = NULL, na = NULL, na_indent = 0L, shorten = c("back", "front", "mid", "abbreviate"), short_formatted = NULL ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Passed on to <code><a href="new_pillar_shaft.html">new_pillar_shaft()</a></code>.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>The maximum column width.</p> </td></tr> <tr valign="top"><td><code>min_width</code></td> <td> <p>The minimum allowed column width, <code>width</code> if omitted.</p> </td></tr> <tr valign="top"><td><code>type_sum</code></td> <td> <p><a href="https://lifecycle.r-lib.org/articles/stages.html#experimental"><img src="../help/figures/lifecycle-experimental.svg" alt='[Experimental]' /></a> </p> <p>Override the type summary displayed at the top of the data. This argument, if given, takes precedence over the type summary provided by <code><a href="type_sum.html">type_sum()</a></code>.</p> </td></tr> <tr valign="top"><td><code>class</code></td> <td> <p>The name of the subclass.</p> </td></tr> <tr valign="top"><td><code>subclass</code></td> <td> <p>Deprecated, pass the <code>class</code> argument instead.</p> </td></tr> <tr valign="top"><td><code>formatted</code></td> <td> <p>The data to show, an object coercible to <a href="../../base/html/character.html">character</a>.</p> </td></tr> <tr valign="top"><td><code>align</code></td> <td> <p>Alignment of the column.</p> </td></tr> <tr valign="top"><td><code>na</code></td> <td> <p>String to use as <code>NA</code> value, defaults to <code>"NA"</code> styled with <code><a href="style_subtle.html">style_na()</a></code> with fallback if color is not available.</p> </td></tr> <tr valign="top"><td><code>na_indent</code></td> <td> <p>Indentation of <code>NA</code> values.</p> </td></tr> <tr valign="top"><td><code>shorten</code></td> <td> <p>How to abbreviate the data if necessary: </p> <ul> <li> <p><code>"back"</code> (default): add an ellipsis at the end </p> </li> <li> <p><code>"front"</code>: add an ellipsis at the front </p> </li> <li> <p><code>"mid"</code>: add an ellipsis in the middle </p> </li> <li> <p><code>"abbreviate"</code>: use <code><a href="../../base/html/abbreviate.html">abbreviate()</a></code> </p> </li></ul> </td></tr> <tr valign="top"><td><code>short_formatted</code></td> <td> <p>If provided, a character vector of the same length as <code>formatted</code>, to be used when the available width is insufficient to show the full output.</p> </td></tr> </table> <h3>Details</h3> <p>The <code>formatted</code> argument may also contain ANSI escapes to change color or other attributes of the text, provided e.g. by the <span class="pkg">cli</span> package. </p> <hr /><div style="text-align: center;">[Package <em>pillar</em> version 1.8.1 <a href="00Index.html">Index</a>]</div> </body></html>