pretty_table.RdWrapper function around pretty_DT() and
ble() that automatically chooses to return a DT table
or a kable table depending on the output type (html or latex).
Specifically, if the requested output type is "html", a pretty DT table is
returned, and if the requested output type is "latex", a pretty kable table
is returned.
pretty_table(
X,
html = knitr::is_html_output(),
digits = 3,
sigfig = TRUE,
rownames = TRUE,
caption = "",
na_disp = "NA",
bold_function = NULL,
bold_margin = NULL,
bold_scheme = TRUE,
bold_color = NULL,
html_options = NULL,
latex_options = NULL,
return_df = FALSE
)Data frame or data matrix to display in table
Logical indicating whether the output should be in html format.
If FALSE, output is in latex format.
Number of digits to display for numeric values
Logical. If TRUE, digits refers to the number of
significant figures. If FALSE, digits refers to the number of
decimal places.
Logical. Whether or not to show rownames in table. See
DT::datatable() for details.
The table caption.
Character string to display if NA entry is found in table.
Optional function or vector of functions
to use for bolding entries, e.g. function(x) x == max(x) or
function(x) x >= 0.5.
Specifies the margins of X that will be used to evaluate
bold_function across, i.e., 0 = across entire matrix, 1 = across
rows, and 2 = across columns. Required if bold_function = TRUE.
Scalar or vector of logicals, indicating whether or not
to apply bold_function to row if bold_margin = 1 and to
column if bold_margin = 1, 2. Default is to apply bolding to all
rows/columns.
Color of bolded text.
List of additional named arguments to pass to
pretty_DT().
List of additional named arguments to pass to
pretty_kable().
Logical. If TRUE, return data frame that was used
as input into DT::datatable() in addition to the datatable output.
If FALSE, only return the datatable output.
A DT table in html format if html = TRUE and a kable table in
latex format if html = FALSE. In addition, if return_df = TRUE, the
data frame that was used to create the table is returned.