Skip to contents

Returns just the display content of a tplyr_build result — the rowlabel*, res*, rdiff*, and pval* columns — and drops the internal ordering helpers (ord_layer_index, ord_layer_*) and the row_id metadata column, giving a frame ready to hand to a table-rendering package (clinify, flextable, gt, ...). The build output is already ordered, so no re-sorting is performed.

Usage

as_display(x, labels = FALSE)

Arguments

x

A data.frame produced by tplyr_build.

labels

Logical. When TRUE, the res* / rdiff* / pval* columns are renamed to their header labels (their label attribute, as returned by get_data_labels); the row-label columns keep their names. Defaults to FALSE.

Value

A data.frame of display columns.

Examples

spec <- tplyr_spec(cols = "TRT", layers = tplyr_layers(group_count("SEX")))
b <- tplyr_build(spec, data.frame(TRT = rep(c("A", "B"), 3),
                                  SEX = rep(c("F", "M"), 3)))
as_display(b)
#>   rowlabel1        res1        res2
#> 1         F  3 (100.0%)   0 ( 0.0%)
#> 2         M   0 ( 0.0%)  3 (100.0%)