tab_kable: Print a tabxplor table in html

tab_kableR Documentation

Print a tabxplor table in html

Description

Print a tabxplor table in html

Usage

tab_kable(
  tabs,
  theme = c("light", "dark"),
  color_type = NULL,
  html_24_bit = NULL,
  tooltips = TRUE,
  popover = NULL,
  color_legend = TRUE,
  caption = knitr::opts_current$get("tab.cap"),
  html_font = NULL,
  get_data = FALSE,
  full_width = FALSE,
  wrap_rows = 35,
  wrap_cols = 15,
  whitespace_only = TRUE,
  ...
)

Arguments

tabs

A table made with tab or tab_many, or a list of tab with the same col_vars and no tab_vars.

theme

By default, a white table with black text, Set to "dark" for a black table with white text.

color_type

Set to "text" to color the text, "bg" to color the background. By default it takes getOption("tabxplor.color_style_type").

html_24_bit

Use 24bits colors palettes for html tables : set to "green_red" or "blue_red". Only with mode = "color_code" (not mode = "crayon") and ⁠theme = "light⁠. Default to getOption("tabxplor.color_html_24_bit").

tooltips

By default, html tooltips are used to display additional informations at mouse hover. Set to FALSE to discard.

popover

By default, takes getOption("tabxplor.kable_popover"). When FALSE, html tooltips are of the base kind : they can't be used with floating table of content in rmarkdown documents. Set to TRUE to use kableExtra html popovers instead, which are compatible with floating toc. Remember to enable the popover module by copying the following code into your document : <script> $(document).ready(function(){ $('[data-toggle="popover"]').popover(); }); </script>

color_legend

Print colors legend below the table ? You can then use a css chunk in rmarkdown to change popovers colors.

caption

The table caption. For formatting, you need to use a css with ⁠caption{}⁠in rmarkdown.

html_font

A string for HTML css font. By default, it uses '"DejaVu Sans", "Arial", arial, helvetica, sans-serif'. Set another default by setting options("tabxplor.kable_html_font" = ).

get_data

Get the transformed data instead of the html table.

full_width

A TRUE or FALSE variable controlling whether the HTML table should have the preferable format for full_width. If not specified, a HTML table will have full width by default but this option will be set to FALSE for a LaTeX table.

wrap_rows

By default, rownames are wrapped when larger than 30 characters.

wrap_cols

By default, colnames are wrapped when larger than 12 characters.

whitespace_only

Set to FALSE to wrap also on non whitespace characters.

...

Other arguments to pass to kableExtra::kable_styling.

Value

A html table (opened in the viewer in RStudio). Differences from totals, confidence intervals, contribution to variance, and unweighted counts, are available in an html tooltip at cells hover.

Examples


tabs <- tab(forcats::gss_cat, race, marital, year, pct = "row", color = "diff")
tab_kable(tabs, theme = "light", color_type = "text")


BriceNocenti/tablr documentation built on April 12, 2025, 12:56 a.m.