blob: 03e11d8b2fbfcab9c49b79a07fd077748258d4f2 [file] [log] [blame]
Hao Zhue10cfd32017-02-21 16:41:14 -05001% 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 Zhu76281fe2017-07-03 19:33:09 -04009When we are talking about table generators in R,
Hao Zhu7f3fa852020-08-26 13:55:38 -040010\href{https://yihui.org/knitr/}{knitr}'s \code{kable()} function wins lots of flavor
Hao Zhu76281fe2017-07-03 19:33:09 -040011by its ultimate simplicity. Unlike those powerful table rendering engines
Hao Zhu9410a272020-08-03 01:11:47 -040012such as \href{https://CRAN.R-project.org/package=xtable}{\code{xtable}}, the philosophy
13behind \href{https://rdrr.io/cran/knitr/man/kable.html}{\code{knitr::kable()}} is to
Hao Zhu76281fe2017-07-03 19:33:09 -040014make it easy for programmers to use. Just as it claimed in its
15function description, "this is a very simple table generator. It is simple
16by design. It is not intended to replace any other R packages for making
17tables. - Yihui".
18
19However, the ultimate simplicity of \code{kable()} also brought troubles to some
20of us, especially for new R users, who may not have a lot of experience on
21generating tables in R. It is not rare to see people including experienced
22users asking questions like how to center/left-align a table on Stack
23Overflow. Also, for me personally, I found myself repeatedly parsing CSS
24into \code{kable()} for some very simple features like striped lines. For LaTeX,
25it's even worse since I'm almost Stack Overflow dependent for LaTeX...
26That's why this package \code{kableExtra} was created.
27
28I 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 Zhu9410a272020-08-03 01:11:47 -040032\item Use \code{kable()} with \code{kableExtra} to generate 90 \% of complex/advanced
Hao Zhu76281fe2017-07-03 19:33:09 -040033tables in either HTML or LaTeX
Hao Zhu9410a272020-08-03 01:11:47 -040034\item Only have to mess with raw HTML/LaTeX in the last 10\% cases where
Hao Zhu76281fe2017-07-03 19:33:09 -040035\code{kableExtra} cannot solve the problem
Hao Zhue10cfd32017-02-21 16:41:14 -050036}
Hao Zhu4b0c51e2017-08-01 15:21:07 -040037
38For a full package documentation, please visit the
Hao Zhu7f3fa852020-08-26 13:55:38 -040039\href{https://haozhu233.github.io/kableExtra/}{package documentation site}
Hao Zhu4b0c51e2017-08-01 15:21:07 -040040for more information
Hao Zhu76281fe2017-07-03 19:33:09 -040041}
42\note{
43If you found a feature on the documentation site that is not available
44in the version of \code{kableExtra} you are using, try to install the pre-release
45version from github. You can do so by running
46\code{devtools::install_github("haozhu233/kableExtra")}.
47
48Also, note that This package can load required LaTeX package automatically in
49vanilla rmarkdown. For customized rmarkdown templates, it is recommended to
50load related LaTeX packages manually.
51}
52\section{Features}{
53
54\strong{Pipable syntax:} \code{kableExtra} is NOT a table generating package. It is a
55package that can "add features" to a \code{kable} output using a syntax
Hao Zhu7f3fa852020-08-26 13:55:38 -040056that every useR loves - the \href{https://r4ds.had.co.nz/pipes.html}{pipe}.
Hao Zhu76281fe2017-07-03 19:33:09 -040057We 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
62specifies 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
64to manipulate the table be themselves. As a result, if users want to left
65align the table, \code{kable_styling(kable(...), position = "left")} will work
66in both HTML and PDF.
67}
68
Hao Zhue10cfd32017-02-21 16:41:14 -050069\keyword{package}