The {gtsummary} package was written to be a companion to the {gt} package from RStudio. But not all output types are supported by the {gt} package. Therefore, we have made it possible to print {gtsummary} tables with various engines.
Here’s a summary of the various R Markdown output types and the print engines that support them.
Print Engine | Function | HTML | RTF | Word | |
---|---|---|---|---|---|
|
|||||
|
|||||
|
|||||
|
|||||
|
Key | |
---|---|
Output fully supported | |
Formatted output, but missing indentation, footnotes, spanning headers | |
No formatted output | |
Output not supported | |
Under development |
Any {gtsummary} table can be converted to one of the types in the table above. For example, the code below prints a {gtsummary} table as a kable table, instead of the default {gt} table.
Tables printed with {gtsummary} can be seamlessly integrated into R markdown documents. Currently, {gt} supports HTML output, with LaTeX and RTF planned for the future. The table below summarizes the default print engine utilized for {gtsummary} tables for various R Markdown output formats.
Output Type | Default Engine | Details |
---|---|---|
HTML |
{gt} |
{gt} output is fully supported with HTML output. |
kable |
You may force printing with {gt} by converting a {gtsummary} object to {gt} with |
|
RTF |
kable |
You may force printing with {gt} by converting a {gtsummary} object to {gt} with |
Word |
kable |
kable is the default print engine for Word output, as {gt} does not support Word. |
When a table is printed with kintr::kable()
the resulting table is less full featured compared to a table printed with {gt}. For example, the table will not contain footnotes, spanning headers, or row indentation.
An example R markdown report using {gtsummary} has been included with the package. To open the example file, run the following command in the R console.