Skip to contents

Create a FlexTable object representing an rtables TableTree

Usage

tt_to_flextable(
  tt,
  paginate = FALSE,
  lpp = NULL,
  cpp = NULL,
  ...,
  colwidths = propose_column_widths(matrix_form(tt, indent_rownames = TRUE)),
  tf_wrap = !is.null(cpp),
  max_width = cpp,
  total_width = 10
)

Arguments

tt

TableTree (or related class). A TableTree object representing a populated table.

paginate

logical(1). Should tt be paginated and exported as multiple flextables. Defaults to FALSE

lpp

numeric. Maximum lines per page including (re)printed header and context rows

cpp

numeric(1) or NULL. Width (in characters) of the pages for horizontal pagination. NA (the default) indicates cpp should be inferred from the page size; NULL indicates no horizontal pagination should be done regardless of page size.

...

Passed on to methods or tabulation functions.

colwidths

numeric vector. Column widths for use with vertical pagination.

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 if tf_wrap is FALSE.

total_width

numeric(1). Total width in inches for the resulting flextable(s). Defaults to 5.

Value

a flextable object

Examples

analysisfun <- function(x, ...) {
    in_rows(row1 = 5,
            row2 = c(1, 2),
            .row_footnotes = list(row1 = "row 1 - row footnote"),
            .cell_footnotes = list(row2 = "row 2 - cell footnote"))
}

lyt <- basic_table(title = "Title says Whaaaat", subtitles = "Oh, ok.",
               main_footer = "ha HA! Footer!") %>%
split_cols_by("ARM") %>%
analyze("AGE", afun = analysisfun)

tbl <-  build_table(lyt, ex_adsl)
ft <- tt_to_flextable(tbl)
#> Loading required namespace: flextable
ft

Oh, ok.

Title says Whaaaat

A: Drug X

B: Placebo

C: Combination

row1 {1}

5

5

5

row2

1, 2 {2}

1, 2 {3}

1, 2 {4}

{1} - row 1 - row footnote

{2} - row 2 - cell footnote

{3} - row 2 - cell footnote

{4} - row 2 - cell footnote

ha HA! Footer!