pillar_shaft: Column data

Description Usage Arguments Details Examples

Description

\Sexpr[results=rd, stage=render]{pillar:::lifecycle("stable")}

Internal class for formatting the data for a column. pillar_shaft() is a coercion method that must be implemented for your data type to display it in a tibble.

This class comes with a default method for print() that calls format(). If print() is called without width argument, the natural width will be used when calling format(). Usually there's no need to implement this method for your subclass.

Your subclass must implement format(), the default implementation just raises an error. Your format() method can assume a valid value for the width argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pillar_shaft(x, ...)

## S3 method for class 'pillar_shaft'
print(x, width = NULL, ...)

## S3 method for class 'pillar_shaft'
format(x, width, ...)

## S3 method for class 'logical'
pillar_shaft(x, ...)

## S3 method for class 'numeric'
pillar_shaft(x, ...,
  sigfig = getOption("pillar.sigfig", 3))

## S3 method for class 'Date'
pillar_shaft(x, ...)

## S3 method for class 'POSIXt'
pillar_shaft(x, ...)

## S3 method for class 'character'
pillar_shaft(x, ..., min_width = 3L)

## S3 method for class 'pillar_vertical'
pillar_shaft(x, ..., min_width = 3L)

## S3 method for class 'list'
pillar_shaft(x, ...)

## S3 method for class 'factor'
pillar_shaft(x, ...)

## S3 method for class 'AsIs'
pillar_shaft(x, ...)

## Default S3 method:
pillar_shaft(x, ...)

Arguments

x

A vector to format

...

Unused, for extensibility.

width

Width for printing and formatting.

sigfig

Minimum number of significant figures to display. Numbers larger than 1 will potentially show more significant figures than this but they will be greyed out.

min_width

Minimum number of characters to display, unless the string fits a shorter width.

Details

The default method will currently format via format(), but you should not rely on this behavior.

Examples

1
2
3
4

pillar documentation built on June 29, 2019, 5:02 p.m.