All Projects → haozhu233 → Kableextra

haozhu233 / Kableextra

Licence: other
Construct Complex Table with knitr::kable() + pipe.

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Kableextra

Rmarkdown Cookbook
R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
Stars: ✭ 324 (-30.32%)
Mutual labels:  latex, rmarkdown, knitr
Knitr Book
Dynamic Documents with R and knitr
Stars: ✭ 215 (-53.76%)
Mutual labels:  latex, rmarkdown, knitr
Knitr Examples
A collection of knitr examples
Stars: ✭ 389 (-16.34%)
Mutual labels:  latex, knitr
Bookdown
Authoring Books and Technical Documents with R Markdown
Stars: ✭ 2,768 (+495.27%)
Mutual labels:  latex, rmarkdown
epoxy
Extra-strength glue engines for R Markdown and Quarto
Stars: ✭ 141 (-69.68%)
Mutual labels:  rmarkdown, knitr
Liftr
🐳 Containerize R Markdown documents for continuous reproducibility
Stars: ✭ 155 (-66.67%)
Mutual labels:  rmarkdown, knitr
Knitr
A general-purpose tool for dynamic report generation in R
Stars: ✭ 2,134 (+358.92%)
Mutual labels:  rmarkdown, knitr
r-novice-inflammation
Programming with R
Stars: ✭ 142 (-69.46%)
Mutual labels:  rmarkdown, knitr
Jupytext
Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
Stars: ✭ 4,969 (+968.6%)
Mutual labels:  rmarkdown, knitr
dicy
A builder for LaTeX, knitr, literate Agda, literate Haskell and Pweave that automatically builds dependencies.
Stars: ✭ 22 (-95.27%)
Mutual labels:  latex, knitr
csasdown
📖 An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Stars: ✭ 40 (-91.4%)
Mutual labels:  latex, rmarkdown
reportfactory
Lightweight infrastructure to handle multiple rmarkdown reports
Stars: ✭ 68 (-85.38%)
Mutual labels:  rmarkdown, knitr
Wraprmd
RStudio addin for wrapping RMarkdown paragraphs
Stars: ✭ 87 (-81.29%)
Mutual labels:  rmarkdown, knitr
Klippy
Copy to Clipboard Buttons for RMarkdown HTML Documents
Stars: ✭ 40 (-91.4%)
Mutual labels:  rmarkdown, knitr
Knitrhooks
Extend {knitr} with hooks
Stars: ✭ 32 (-93.12%)
Mutual labels:  rmarkdown, knitr
Atom Latex
Compile LaTeX or knitr documents from within Atom
Stars: ✭ 219 (-52.9%)
Mutual labels:  latex, knitr
xaringan slides
📺 Links to HTML5 presentations made using the R package {xaringan}.
Stars: ✭ 20 (-95.7%)
Mutual labels:  rmarkdown, knitr
tikz favorites
collection of favorite TikZ graphics
Stars: ✭ 62 (-86.67%)
Mutual labels:  latex, rmarkdown
ntuthesis
台大碩博士論文模板 (R Package)
Stars: ✭ 14 (-96.99%)
Mutual labels:  latex, rmarkdown
Crowbook
Converts books written in Markdown to HTML, LaTeX/PDF and EPUB
Stars: ✭ 399 (-14.19%)
Mutual labels:  latex

kableExtra logo

CRAN_version CRAN_download CRAN_download_total DOI


When we are talking about table generators in R, knitr's kable() function is usually a popular choice because of its ultimate simplicity. Unlike those powerful table rendering engines such as xtable, the philosophy behind knitr::kable() is to make it easy for programmers to use. Just as it claimed in its function description,

This is a very simple table generator. It is simple by design. It is not intended to replace any other R packages for making tables. - Yihui

However, the ultimate simplicity of kable() also brought troubles to some of us, especially for new R users, who may not have a lot of experience on generating tables in R. It is not rare to see people including experienced users asking questions like how to center/left-align a table on Stack Overflow. Also, for me personally, I found myself repeatedly parsing CSS into kable() for some very simple features like striped lines. For LaTeX, it's even worse since I'm almost Stack Overflow dependent for LaTeX... That's why this package kableExtra was created.

I hope with kableExtra, you can

  • Use default base kable() (Or a good alternative for markdown tables is pander::pander()) for all simple tables
  • Use kable() with kableExtra to generate 90 % of complex/advanced/self-customized/beautiful tables in either HTML or LaTeX
  • Only have to mess with raw HTML/LaTeX in the last 10% cases where kableExtra cannot solve the problem

This package can load required LaTeX package automatically in vanilla rmarkdown. For customized rmarkdown templates, it is recommended to load related LaTeX packages manually.


Features

Pipable syntax

kableExtra is NOT a table generating package. It is a package that can "add features" to a kable() output using a syntax that every useR loves - the pipes %>%. We see similar approaches to deal with plots in packages like ggvis and plotly. There is no reason why we cannot use it with tables.

Unified functions for both HTML and PDF

Most functionalities in kableExtra can work in both HTML and PDF. In fact, as long as you specifies format in kable() (which can be set globally through option knitr.table.format), functions in this package will pick the right way to manipulate the table be themselves. As a result, if users want to left align the table, kable(...) %>% kable_styling(position = "left") will work in both HTML and PDF. Recently, we also introduced a new kbl() function acting as an alternative to kable but provides better documentation and format detection.

Install

install.packages("kableExtra")

# For dev version
devtools::install_github("haozhu233/kableExtra")

Basic Usage

library(kableExtra)
dt <- mtcars[1:5, 1:4]

# HTML table
kbl(dt, caption = "Demo Table") %>%
  kable_styling(bootstrap_options = "striped",
                full_width = F) %>%
  add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
  footnote(c("table footnote"))

# LaTeX Table
kbl(dt, booktabs = T, caption = "Demo Table") %>%
  kable_styling(latex_options = c("striped", "hold_position"),
                full_width = F) %>%
  add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
  footnote(c("table footnote"))

Results

More Information

For more information, please check the package vignette.

Acknowledgement

I would like to thank colleagues at Hebrew SeniorLife Marcus Institute for Aging Research and the Boston Pepper Center for their input. I also would like to appreciate the mentorship from Tom Travison (@tgt75) and all the efforts from the open source community, which help this package keep getting better.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].