Hao Zhu | e10cfd3 | 2017-02-21 16:41:14 -0500 | [diff] [blame] | 1 | % Generated by roxygen2: do not edit by hand |
| 2 | % Please edit documentation in R/kableExtra-package.R |
| 3 | \docType{package} |
| 4 | \name{kableExtra-package} |
| 5 | \alias{kableExtra-package} |
| 6 | \alias{kableExtra} |
| 7 | \title{kableExtra} |
| 8 | \description{ |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 9 | When we are talking about table generators in R, |
| 10 | \href{https://yihui.name/knitr/}{knitr}'s \code{kable()} function wins lots of flavor |
| 11 | by its ultimate simplicity. Unlike those powerful table rendering engines |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame^] | 12 | such as \href{https://CRAN.R-project.org/package=xtable}{\code{xtable}}, the philosophy |
| 13 | behind \href{https://rdrr.io/cran/knitr/man/kable.html}{\code{knitr::kable()}} is to |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 14 | make it easy for programmers to use. Just as it claimed in its |
| 15 | function description, "this is a very simple table generator. It is simple |
| 16 | by design. It is not intended to replace any other R packages for making |
| 17 | tables. - Yihui". |
| 18 | |
| 19 | However, the ultimate simplicity of \code{kable()} also brought troubles to some |
| 20 | of us, especially for new R users, who may not have a lot of experience on |
| 21 | generating tables in R. It is not rare to see people including experienced |
| 22 | users asking questions like how to center/left-align a table on Stack |
| 23 | Overflow. Also, for me personally, I found myself repeatedly parsing CSS |
| 24 | into \code{kable()} for some very simple features like striped lines. For LaTeX, |
| 25 | it's even worse since I'm almost Stack Overflow dependent for LaTeX... |
| 26 | That's why this package \code{kableExtra} was created. |
| 27 | |
| 28 | I hope with \code{kableExtra}, you can |
| 29 | \itemize{ |
| 30 | \item Use default base \code{kable()} (Or a good alternative for markdown tables is |
| 31 | \code{pander::pander()}) for all simple tables |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame^] | 32 | \item Use \code{kable()} with \code{kableExtra} to generate 90 \% of complex/advanced |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 33 | tables in either HTML or LaTeX |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame^] | 34 | \item Only have to mess with raw HTML/LaTeX in the last 10\% cases where |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 35 | \code{kableExtra} cannot solve the problem |
Hao Zhu | e10cfd3 | 2017-02-21 16:41:14 -0500 | [diff] [blame] | 36 | } |
Hao Zhu | 4b0c51e | 2017-08-01 15:21:07 -0400 | [diff] [blame] | 37 | |
| 38 | For a full package documentation, please visit the |
| 39 | \href{http://haozhu233.github.io/kableExtra/}{package documentation site} |
| 40 | for more information |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 41 | } |
| 42 | \note{ |
| 43 | If you found a feature on the documentation site that is not available |
| 44 | in the version of \code{kableExtra} you are using, try to install the pre-release |
| 45 | version from github. You can do so by running |
| 46 | \code{devtools::install_github("haozhu233/kableExtra")}. |
| 47 | |
| 48 | Also, note that This package can load required LaTeX package automatically in |
| 49 | vanilla rmarkdown. For customized rmarkdown templates, it is recommended to |
| 50 | load related LaTeX packages manually. |
| 51 | } |
| 52 | \section{Features}{ |
| 53 | |
| 54 | \strong{Pipable syntax:} \code{kableExtra} is NOT a table generating package. It is a |
| 55 | package that can "add features" to a \code{kable} output using a syntax |
| 56 | that every useR loves - the \href{http://r4ds.had.co.nz/pipes.html}{pipe}. |
| 57 | We see similar approaches to deal with plots in packages like \code{ggvis} and |
| 58 | \code{plotly}. There is no reason why we cannot use it with tables. |
| 59 | |
| 60 | \strong{Unified functions for both HTML and PDF:} Most functionalities in |
| 61 | \code{kableExtra} can work in both HTML and PDF. In fact, as long as you |
| 62 | specifies format in \code{kable} (which can be set globally through option |
| 63 | \code{knitr.table.format}), functions in this package will pick the right way |
| 64 | to manipulate the table be themselves. As a result, if users want to left |
| 65 | align the table, \code{kable_styling(kable(...), position = "left")} will work |
| 66 | in both HTML and PDF. |
| 67 | } |
| 68 | |
Hao Zhu | e10cfd3 | 2017-02-21 16:41:14 -0500 | [diff] [blame] | 69 | \keyword{package} |