kableExtra

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

https://github.com/haozhu233/kableextra

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    6 of 51 committers (11.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

html kable kableextra knitr latex rmarkdown

Keywords from Contributors

data-manipulation grammar tidy-data book bookdown epub gitbook
Last synced: 6 months ago · JSON representation

Repository

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

Basic Info
Statistics
  • Stars: 721
  • Watchers: 24
  • Forks: 152
  • Open Issues: 142
  • Releases: 3
Topics
html kable kableextra knitr latex rmarkdown
Created over 10 years ago · Last pushed 6 months ago
Metadata Files
Readme Funding License

README.md

kableExtra logo

CRAN_version CRAN_download CRAN_download_total DOI R-CMD-check <!-- badges: end -->


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 R Markdown. For customized R Markdown 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

```r install.packages("kableExtra")

For dev version

devtools::install_github("haozhu233/kableExtra") ```

Basic Usage

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

HTML table

kbl(dt, caption = "Demo Table") %>% kablestyling(bootstrapoptions = "striped", fullwidth = F) %>% addheader_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>% footnote(c("table footnote"))

LaTeX Table

kbl(dt, booktabs = T, caption = "Demo Table") %>% kablestyling(latexoptions = c("striped", "holdposition"), fullwidth = F) %>% addheaderabove(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.

Owner

  • Name: Hao Zhu
  • Login: haozhu233
  • Kind: user
  • Location: Boston, MA
  • Company: Harvard Medical School

AI for science. Netbio.

GitHub Events

Total
  • Issues event: 40
  • Watch event: 31
  • Delete event: 13
  • Issue comment event: 104
  • Push event: 50
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Pull request event: 40
  • Fork event: 9
  • Create event: 17
Last Year
  • Issues event: 40
  • Watch event: 31
  • Delete event: 13
  • Issue comment event: 104
  • Push event: 50
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Pull request event: 40
  • Fork event: 9
  • Create event: 17

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 623
  • Total Committers: 51
  • Avg Commits per committer: 12.216
  • Development Distribution Score (DDS): 0.212
Past Year
  • Commits: 3
  • Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Hao Zhu h****3@g****m 491
Hao Zhu h****u@h****u 12
Will Beasley w****y@h****m 12
Bill Evans B****l@8****m 11
Duncan Murdoch m****n@g****m 9
Salzer b****r@g****m 8
Samia s****0@g****m 6
Dan Chaltiel d****l@g****m 5
Vincent Arel-Bundock v****k@u****a 5
jokorn j****t@o****m 5
bsalzer 3****r@u****m 5
antaldaniel a****l@g****m 5
Kirill Müller k****r@m****g 3
kbrevoort k****n@b****m 3
Augusto Magalhães a****e@o****m 2
Jiaxiang Li a****g@f****m 2
Bill Evans B****s@A****m 2
Salim B s****m@p****e 2
Irene 2****s@u****m 2
Cillian Berragan c****n@g****m 2
Rob Shepherd r****d@g****m 1
AC Craft a****4@g****m 1
Alan Butler r****r@u****v 1
Jakob Richter c****e@j****e 1
Leo l****n@h****m 1
Deependra Dhakal d****d@g****m 1
Quôc Peyrot 4****t@u****m 1
Adrien Le Guillou a****u@g****m 1
Gregory Fiumara g****g@g****m 1
Jebu j****u@e****k 1
and 21 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 238
  • Total pull requests: 96
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 2 months
  • Total issue authors: 215
  • Total pull request authors: 26
  • Average comments per issue: 2.55
  • Average comments per pull request: 0.97
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 27
  • Pull requests: 34
  • Average time to close issues: 16 days
  • Average time to close pull requests: 3 days
  • Issue authors: 25
  • Pull request authors: 8
  • Average comments per issue: 2.07
  • Average comments per pull request: 0.44
  • Merged pull requests: 19
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ujtwr (4)
  • thmschk (3)
  • HenrikEckermann (3)
  • raffaem (2)
  • zahlenzauber (2)
  • turbanisch (2)
  • onecare-business-intelligence (2)
  • FelipeCarrillo (2)
  • tomasrei (2)
  • Chanelle280 (2)
  • aipe (2)
  • hnguyen19 (2)
  • vincentarelbundock (2)
  • englianhu (2)
  • pdmayer (2)
Pull Request Authors
  • dmurdoch (51)
  • vincentarelbundock (10)
  • r2evans (6)
  • bd-karen-byron (4)
  • haozhu233 (3)
  • krlmlr (3)
  • fjesser (2)
  • sonicseamus (2)
  • KJByron (2)
  • RockfordMankiniUCSD (2)
  • MichaelChirico (2)
  • OscardR (1)
  • ThierryO (1)
  • jamarav (1)
  • q-w-a (1)
Top Labels
Issue Labels
enhancement (13) bug (5) workaround (2) tabu (1) wontfix (1)
Pull Request Labels

Packages

  • Total packages: 4
  • Total downloads:
    • cran 91,997 last-month
  • Total docker downloads: 107,000
  • Total dependent packages: 331
    (may contain duplicates)
  • Total dependent repositories: 1,327
    (may contain duplicates)
  • Total versions: 36
  • Total maintainers: 1
cran.r-project.org: kableExtra

Construct Complex Table with 'kable' and Pipe Syntax

  • Versions: 22
  • Dependent Packages: 323
  • Dependent Repositories: 1,276
  • Downloads: 91,997 Last month
  • Docker Downloads: 107,000
Rankings
Dependent repos count: 0.3%
Dependent packages count: 0.4%
Forks count: 0.4%
Stargazers count: 0.5%
Downloads: 1.2%
Average: 3.4%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/haozhu233/kableExtra
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 6 months ago
proxy.golang.org: github.com/haozhu233/kableextra
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 6 months ago
conda-forge.org: r-kableextra
  • Versions: 8
  • Dependent Packages: 8
  • Dependent Repositories: 51
Rankings
Dependent repos count: 5.0%
Dependent packages count: 7.1%
Average: 11.0%
Forks count: 15.8%
Stargazers count: 16.3%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.1.0 depends
  • digest * imports
  • glue * imports
  • grDevices * imports
  • graphics * imports
  • htmltools * imports
  • knitr >= 1.16 imports
  • magrittr * imports
  • rmarkdown >= 1.6.0 imports
  • rstudioapi * imports
  • rvest * imports
  • scales * imports
  • stats * imports
  • stringr >= 1.0 imports
  • svglite * imports
  • tools * imports
  • viridisLite * imports
  • webshot * imports
  • xml2 >= 1.1.1 imports
  • formattable * suggests
  • magick * suggests
  • sparkline * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
  • r-lib/actions/setup-tinytex v2 composite