Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

new_pillar

Construct a custom pillar object


Description

[Experimental]

new_pillar() is the low-level constructor for pillar objects. It supports arbitrary components. See pillar() for the high-level constructor with default components.

Usage

new_pillar(components, ..., width = NULL, class = NULL)

Arguments

components

A named list of components constructed with pillar_component().

...

These dots are for future extensions and must be empty.

width

Default width, optional.

class

Name of subclass.

Details

Arbitrary components are supported. If your tibble subclass needs more or different components in its pillars, override or extend ctl_new_pillar() and perhaps ctl_new_compound_pillar().

Examples

lines <- function(char = "-") {
  stopifnot(nchar(char) == 1)
  structure(char, class = "lines")
}

format.lines <- function(x, width, ...) {
  paste(rep(x, width), collapse = "")
}

new_pillar(list(
  title = pillar_component(new_ornament(c("abc", "de"), align = "right")),
  lines = new_pillar_component(list(lines("=")), width = 1)
))

pillar

Coloured Formatting for Columns

v1.6.0
MIT + file LICENSE
Authors
Kirill Müller [aut, cre], Hadley Wickham [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.