commit | 8eadc6a787ba76f29a315c0dbb064301b0552a20 | [log] [tgz] |
---|---|---|
author | Hao Zhu <haozhu@hsl.harvard.edu> | Mon Jan 11 12:57:50 2016 -0500 |
committer | Hao Zhu <haozhu@hsl.harvard.edu> | Mon Jan 11 12:57:50 2016 -0500 |
tree | 10b2fc33e83fa416df866b7dfaea5efb57a0c6fb | |
parent | 37934b8117ab83960e3b9961263bc5808bfff72e [diff] | |
parent | 70aa3b2843cb39d322f68df54b0b6e3c084c3f5a [diff] |
Merge pull request #2 from wibeasley/master doc for `threeparttable` parameter
This package is still in an "as-is" state. You can save a lot of finger-typing time by using it but you still need to understand what is really going on behind the hood, which is still far behind my goal. Also, since the default output format of kable
is markdown
, which doesn't support high-level table customization, it may not work well in many cases. I would recommend you to set the format
option in each kable
function or to define options(knitr.table.format = 'html')
or latex
somewhere in your document.
When we are talking about table generators in R
, knitr::kable
wins the favor of a lot of people by its ultimate simplicity. Unlike those powerful table rendering engine such as xtable
, tables
or even gridExtra
, the philosophy behind 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, we also see a lot of people getting frustrated online for the lack of functionality of kable
. It is kind of unfair to kable
as it is supposed to be "simple" by design. However, it is also understandable as people cry because they love to use this function instead of those complicated alternatives.
In kableExtra
, we are not intended to build another table generator engine as there have been a lot (actually too many in my personal opinion) in R
. This package is an attempt to extend knitr::kable
's functionality without destroying the beauty of its simplicity by using the pipe syntax from magrittr
. We will follow the literal programming practice and try to make the progress of building a table in R
go together with the flow of logic in your mind. We will also borrow the idea of "grammar of graphics" from ggplot2
and ggvis
and implement it in the progress of table generating tasks.
Here is a list of features that we would love to see in this package. I bolded these that have been done.
The syntax of this package is just like what you are doing in dplyr
or ggvis
. Here is an example of adding footnote to a kable
object.
library(knitr) library(kableExtra) cars %>% head() %>% rename("speed[note]" = speed) %>% kable(caption = "Head of cars [note]") %>% add_footnote( label = c("Footnote in caption", "Footnote in table"), notation = "number" # Or "alphabet"/"symbol" )
These two documents demonstrate the different behaviors under HTML and LaTeX (including booktabs and longtable) * HTML demo: http://rpubs.com/haozhu233/kableExtra_footnote_html * PDF demo: https://www.dropbox.com/s/qk7msi64mndn67y/brief_demo_pdf.pdf?dl=0