dtables2flextable: turn dtables to flextable

dtables2flextableR Documentation

turn dtables to flextable

Usage

dtables2flextable(
  object,
  template = NULL,
  caption = NULL,
  use.groups = NULL,
  indent = c(3, 3),
  gray = TRUE,
  fontsize = c(11, 11, 9),
  all.name = "All"
)

Arguments

object

A return object from dtables

template

Optional; a data.frame with entries 'label' (corresponding to the labels used for variables in the dtables object) in the order wanted, and (optionally) an entry 'group' if grouping is wanted.

caption

The caption

use.groups

Use grouping given by the template. Will use grouping (if such is given) if NULL

indent

flextable printing will recognise spaces in docx and pdf, indent is a length 2 vector. First entry is the indentation used for variables/labels with respect to row groups. The second entry is used for categorical level displayed with respect to variables/labels.

gray

logical; mark every other variable with gray background

fontsize

length 3 vector; fontsize used for header, body and footer, respectively.

all.name

if there is no (column) grouping, what should be the name used to the single column displayed (default "All")

Examples

## dd is the template
dd <- data.frame(label = names(mtcars),
                 group = rep(c("A Foo", "The baz"), c(5,6)))
dt <- dtables(mtcars, indent = "", perc.sign = "%")
dtf <- dtables2flextable(dt, template = dd, caption = "Example",
                         all.name = "All cars!")
## to view:
## print(dtf, preview = "html")
## print(dtf, preview = "docx")
## print(dtf, preview = "pdf", latex_engine = "xelatex")

renlund/descripteur documentation built on Sept. 24, 2023, 7:07 p.m.