Create an output-independent, well formatted kable table
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}")
)
data.frame, tibble, named matrix or a knitr_kable object.
Number of digits to display in the case of numeric variables.
A table caption, defaults to empty NA
.
The col.names parameter of the kable table, if NULL
,
filled with the names of the data_table
.
Defaults to NULL
. In this case all col_align parameters
will be "c"
for centered.
Defaults to "cm"
.
Defaults to NULL
. In this case 'l'
for the
first column and 'r'
for the rest of the columns,
i.e."l", "c", ..., "c"
Defaults to NULL
.
In this case TRUE
for the first column and FALSE
for the rest of the columns, i.e.T, F, ..., F
Defaults to NULL
. In this case none of the
the columns are bold, i.e. identical to F, F, ..., F
.
Defaults to c("striped", "hover", "condensed")
and
only used for output_format = "html"
.
Defaults to NULL)
.
Defaults to 'html'
. Alternatives are 'latex'
.
'image'
, recommended for Word files, is removed because it depends
on magick which is not available on all R platforms.
Defaults to FALSE
and only used if output_format = 'image'
.
Currently defaults to c(
"\usepackage[magyar]{babel}",
"\usepackage[utf8]{inputenc}")
It can be any valid latex option setting, but if packages are used, the
packages must be installed on your Latex engine.
# NOT RUN {
foo = data.frame (
observation = c("indicator1", "indicator2", "indicator3"),
indicator_1 = c(100,105,95),
indicator_2 = c(102,104,76)
)
# }
Run the code above in your browser using DataLab