dyn_table: Use a different table style depending on the output format

View source: R/dyn_table.R

dyn_tableR Documentation

Use a different table style depending on the output format

Description

  • interactive session: DT::datatable()

  • html: DT::datatable()

  • other: knitr::kable()

Usage

dyn_table(x, caption = NULL, rownames = FALSE, escape = TRUE, align, ...)

Arguments

x

the dataframe

caption

the table caption; a character vector or a tag object generated from htmltools::tags$caption()

rownames

TRUE (show row names) or FALSE (hide row names) or a character vector of row names; by default, the row names are displayed in the first column of the table if exist (not NULL)

escape

whether to escape HTML entities in the table: TRUE means to escape the whole table, and FALSE means not to escape it; alternatively, you can specify numeric column indices or column names to indicate which columns to escape, e.g. 1:5 (the first 5 columns), c(1, 3, 4), or c(-1, -3) (all columns except the first and third), or c('Species', 'Sepal.Length'); since the row names take the first column to display, you should add the numeric column indices by one when using rownames

align

Column alignment: a character vector consisting of 'l' (left), 'c' (center) and/or 'r' (right). By default or if align = NULL, numeric columns are right-aligned, and other columns are left-aligned. If length(align) == 1L, the string will be expanded to a vector of individual letters, e.g. 'clc' becomes c('c', 'l', 'c'), unless the output format is LaTeX.

...

Other arguments (see Examples and References).

See Also

Other utils: add_author(), add_report_numbers(), check_dependencies(), column_start(), column_width(), cover_info(), create_report(), references(), render_natbib(), validate_doi()


inbo/INBOmd documentation built on Feb. 3, 2024, 5:58 p.m.