Skip to contents

A function to display tables in reports.

Usage

report_table(table, colwidths = "auto", maxrows = 2, escape = FALSE)

Arguments

table

the data frame to show in a table, or a vector for a list

colwidths

set column widths as a vector of px (number > 1) or percent (numbers <= 1)

maxrows

if the table has more rows than this, paginate (full report, with a menu to show more rows per page, or all) or show a scrollbar sized to approximately this many rows (simple report)

escape

whether or not to escape the table (necessary if using raw html)

Value

the datatable (full report) or a knitr::kable object (simple report)

Details

When report_type() is "simple", "simple_brief" or "checklist", this renders a plain static HTML table (via knitr::kable()) in a CSS-only scrollable box instead of a DT::datatable() widget – no JavaScript at all, so the report stays safe to email. Every row is kept and reachable by scrolling (just like the full report's paginated widget, just without the JS), except for a pathologically large table, which is truncated to .report_table_simple_max_rows rows with a note, so one huge table cannot make the report unboundedly large.

Examples

report_table(iris)