Debian Codegraph @

man/ctl_new_pillar_list.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/ctl_new_pillar_list.R
3 \name{ctl_new_pillar_list}
4 \alias{ctl_new_pillar_list}
5 \title{Customize the appearance of compound pillars in your tibble subclass}
6 \usage{
7 ctl_new_pillar_list(
8 controller,
9 x,
10 width,
11 ...,
12 title = NULL,
13 first_pillar = NULL
14 )
15 }
16 \arguments{
17 \item{controller}{The object of class \code{"tbl"} currently printed.}
18
19 \item{x}{A vector, can also be a data frame, matrix, or array.}
20
21 \item{width}{The available width, can be a vector for multiple tiers.
22 If \code{NULL}, only the first pillar is instantiated.}
23
24 \item{...}{These dots are for future extensions and must be empty.}
25
26 \item{title}{The title, derived from the name of the column in the data.}
27
28 \item{first_pillar}{Can be passed to this method if the first pillar
29 for a compound pillar (or the pillar itself for a simple pillar)
30 has been constructed already.}
31 }
32 \description{
33 \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
34
35 Gain full control over the appearance of the pillars of your tibble subclass
36 in its body.
37 This method is intended for implementers of subclasses of the \code{"tbl"} class.
38 Users will rarely need them, and we also expect the default implementation
39 to be sufficient for the vast majority of cases.
40 }
41 \details{
42 \code{ctl_new_pillar_list()} is called to construct a list of pillars.
43 If \code{x} is a regular (one-dimensional) vector, the list contains one pillar
44 constructed by \code{\link[=ctl_new_pillar]{ctl_new_pillar()}}.
45 This method also works for compound columns: columns that are data frames,
46 matrices or arrays, with the following behavior:
47 \itemize{
48 \item If \code{width} is \code{NULL}, the method always returns a list of length one
49 containing one pillar object that represents the first sub-column in this
50 compound column.
51 \item Otherwise, the returned list contains one pillar object for all sub-columns
52 that can be fit in the available horizontal space.
53 These pillar objects are obtained by calling \code{ctl_new_pillar_list()}
54 with \code{width = NULL} on each sub-column until the available width is
55 exhausted.
56 }
57
58 This method is called to initiate the construction of all pillars
59 in the tibble to be printed.
60 To ensure that all packed columns that fit the available space are printed,
61 \code{ctl_new_pillar_list()} may be called twice on the same input:
62 once with \code{width = NULL}, and
63 once with \code{width} corresponding to the then known available space
64 and with \code{first_pillar} set to the pillar object constructed in the
65 first call.
66 }
67 \examples{
68 \dontshow{if (rlang::is_installed(c("palmerpenguins", "tibble")) && requireNamespace("tibble")) withAutoprint(\{ # examplesIf}
69 # Simple column
70 ctl_new_pillar_list(
71 tibble::tibble(),
72 palmerpenguins::penguins$weight[1:3],
73 width = 10
74 )
75
76 # Packed data frame: unknown width
77 ctl_new_pillar_list(
78 tibble::tibble(),
79 palmerpenguins::penguins[1:3, ],
80 width = NULL
81 )
82
83 # Packed data frame: known width
84 ctl_new_pillar_list(
85 tibble::tibble(),
86 palmerpenguins::penguins,
87 width = 60
88 )
89
90 # Deeply packed data frame with known width:
91 # showing only the first sub-column even if the width is sufficient
92 ctl_new_pillar_list(
93 tibble::tibble(),
94 tibble::tibble(x = tibble::tibble(b = 1, c = 2), y = 3),
95 width = 60
96 )
97
98 # Packed matrix: unknown width
99 ctl_new_pillar_list(tibble::tibble(), matrix(1:6, ncol = 2), width = NULL)
100
101 # Packed matrix: known width
102 ctl_new_pillar_list(tibble::tibble(), matrix(1:6, ncol = 2), width = 60)
103
104 # Packed array
105 ctl_new_pillar_list(tibble::tibble(), Titanic, width = 60)
106 \dontshow{\}) # examplesIf}
107 }