A table shell is a rendering of the table which maintains the structure, but does not display the values, rather displaying the formatting instructions for each cell.
Usage
table_shell(
tt,
widths = NULL,
col_gap = 3,
hsep = default_hsep(),
tf_wrap = FALSE,
max_width = NULL
)
table_shell_str(
tt,
widths = NULL,
col_gap = 3,
hsep = default_hsep(),
tf_wrap = FALSE,
max_width = NULL
)
Arguments
- tt
TableTree
(or related class). ATableTree
object representing a populated table.- widths
widths of row.name and columns
- col_gap
gap between columns
- hsep
character to create line separator
- tf_wrap
logical(1). Should the texts for title, subtitle, and footnotes be wrapped?
- max_width
integer(1), character(1) or NULL. Width that title and footer (including footnotes) materials should be word-wrapped to. If NULL, it is set to the current print width of the session (
getOption("width")
). If set to"auto"
, the width of the table (plus any table inset) is used. Ignored completely iftf_wrap
isFALSE
.
Value
for table_shell_str
the string representing the table shell, for table_shell
,
NULL
, as the function is called for the side effect of printing the shell to the console
Examples
library(dplyr)
iris2 <- iris %>%
group_by(Species) %>%
mutate(group = as.factor(rep_len(c("a", "b"), length.out = n()))) %>%
ungroup()
lyt <- basic_table() %>%
split_cols_by("Species") %>%
split_cols_by("group") %>%
analyze(c("Sepal.Length", "Petal.Width"), afun = list_wrap_x(summary) , format = "xx.xx")
tbl <- build_table(lyt, iris2)
table_shell(tbl)
#> setosa versicolor virginica
#> a b a b a b
#> ————————————————————————————————————————————————————————————
#> Sepal.Length - - - - - -
#> Min. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> 1st Qu. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Median xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Mean xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> 3rd Qu. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Max. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Petal.Width - - - - - -
#> Min. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> 1st Qu. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Median xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Mean xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> 3rd Qu. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx
#> Max. xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx