Wrapper around knitr::kable()
with sensible defaults
for alignment, borders, and formatting, compatible with HTML and LaTeX
output formats.
create_knitr_table(
data_table,
digits = NULL,
caption = NA,
col.names = NULL,
col_width = NULL,
width_unit = "cm",
col_align = NULL,
border_right_cols = NULL,
bold_cols = NULL,
bootstrap_options = c("striped", "hover", "condensed"),
latex_options = NULL,
output_format = NULL,
keep_pdf = FALSE,
latex_header_includes = c("\\usepackage[magyar]{babel}",
"\\usepackage[utf8]{inputenc}")
)
A knitr_kable
object with styling applied.
A data.frame
, tibble, named matrix, or knitr_kable
object.
Number of digits to display for numeric variables.
Defaults to getOption("digits")
.
Optional table caption. Defaults to NA
(no caption).
Column names for the table. If NULL
, uses
names(data_table)
.
Numeric vector of column widths. If NULL
, defaults to
2 for the first column and equal share for the rest.
Character. Unit for column widths (default "cm"
).
Column alignment. Defaults to "l"
for the first column,
"c"
for others.
Logical vector for right-hand column borders.
Defaults to TRUE
for the first column, FALSE
otherwise.
Logical vector. If TRUE
, makes the column bold.
Defaults to all FALSE
.
Passed to kableExtra::kable_styling()
for
HTML output. Defaults to c("striped", "hover", "condensed")
.
Passed to kableExtra::kable_styling()
for
LaTeX output. Defaults to c("scale_down", "striped")
.
Character: "html"
, "latex"
, or "image"
.
If NULL
, auto-detects from knitr options.
Logical. Only relevant for output_format = "image"
.
Defaults to FALSE
.
Character vector of LaTeX headers to include.
Defaults to c("\\usepackage[magyar]{babel}", "\\usepackage[utf8]{inputenc}")
.