pillar_shaft

0th

Percentile

Column data

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
pillar_shaft(x, ...)

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

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

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

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

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

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

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

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

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

# S3 method for default 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 coerce via as.character(), but you should not rely on this behavior.

Aliases
  • pillar_shaft
  • print.pillar_shaft
  • format.pillar_shaft
  • pillar_shaft.logical
  • pillar_shaft.numeric
  • pillar_shaft.Date
  • pillar_shaft.POSIXt
  • pillar_shaft.character
  • pillar_shaft.list
  • pillar_shaft.AsIs
  • pillar_shaft.default
Examples
# NOT RUN {
pillar_shaft(1:3)
pillar_shaft(1.5:3.5)
pillar_shaft(NA)
pillar_shaft(c(1:3, NA))
# }
Documentation reproduced from package pillar, version 1.2.3, License: GPL-3

Community examples

Looks like there are no examples yet.