Added some documentation for new features
diff --git a/vignettes/awesome_table_in_html.Rmd b/vignettes/awesome_table_in_html.Rmd
index 7ef2344..a98ca1e 100644
--- a/vignettes/awesome_table_in_html.Rmd
+++ b/vignettes/awesome_table_in_html.Rmd
@@ -14,20 +14,15 @@
%\VignetteEncoding{UTF-8}
---
-> ⚠ For LaTeX tables, please see the [package site](http://haozhu233.github.io/kableExtra/) for more information.
-
# Overview
The goal of `kableExtra` is to help you build common complex tables and manipulate table styles. It imports the pipe `%>%` symbol from `magrittr` and verbalize all the functions, so basically you can add "layers" to a kable output in a way that is similar with `ggplot2` and `plotly`.
# Installation
-Some LaTeX features in `kableExtra`, such as striped line, requires rmarkdown 1.4.0+, which is not yet on CRAN. It is highly recommended to install the dev version of rmarkdown before you try this package. If you only use this package for HTML table, it doesn't matter what version of rmarkdown you are using.
```r
-# install.packages("devtools")
-devtools::install_github("rstudio/rmarkdown")
-
install.packages("kableExtra")
# For dev version
+# install.packages("devtools")
devtools::install_github("haozhu233/kableExtra")
```
# Getting Started
@@ -48,8 +43,7 @@
## Basic HTML Table
Basic HTML output of `kable` looks very crude. To the end, it's just a plain HTML table without any love from css.
```{r}
-kable(dt, caption = "clust") %>%
- kable_styling(full_width = F)
+kable(dt)
```
## Apply Bootstrap
@@ -84,7 +78,7 @@
```
## Full Width or Not?
-By default, a bootstrap table takes 100% of the width. It is supposed to use together with its grid system to scale the table properly. However, when you are writing a rmarkdown document, you probably don't want to write your own css/or grid. For some small tables with only few columns, a page wide table looks awful. To make it easier, you can specify whether you want the table to have `full_width` or not in `kable_styling`. By default, `full_width` is set to be `TRUE` for HTML tables (note that for LaTeX, the default is `FALSE` since I don't want to change the "common" looks unless you specified it. )
+By default, a bootstrap table takes 100% of the width. It is supposed to use together with its grid system to scale the table properly. However, when you are writing a rmarkdown document, you probably don't want to write your own css/or grid. For some small tables with only few columns, a page wide table looks awful. To make it easier, you can specify whether you want the table to have `full_width` or not in `kable_styling`. By default, `full_width` is set to be `TRUE` for HTML tables (note that for LaTeX, the default is `FALSE` since I don't want to change the "common" looks unless you specified it.)
```{r}
kable(dt) %>%
kable_styling(bootstrap_options = "striped", full_width = F)
@@ -164,3 +158,32 @@
"Group 2 contains hp, drat and wt"),
notation = "symbol")
```
+
+---
+
+The following features are introduced in `kableExtra` 0.2.0.
+
+# Group Rows
+Sometimes we want a few rows of the table being grouped together. They might be items under the same topic (e.g., animals in one species) or just different data groups for a categorical variable (e.g., age < 40, age > 40). With the new function `group_rows()` in `kableExtra`, this kind of task can be completed in one line. Please see the example below. Note that when you count for the start/end rows of the group, you don't need to count for the header rows nor other group label rows. You only need to think about the row numbers in the "original R dataframe".
+```{r}
+kable(mtcars[1:10, 1:6], format = "html", caption = "Group Rows") %>%
+ kable_styling("striped", full_width = F) %>%
+ group_rows("Group 1", 4, 7) %>%
+ group_rows("Group 2", 8, 10)
+```
+
+For advanced users, you can even define your own css for the group labeling.
+```{r}
+kable(dt, format = "html") %>%
+ kable_styling("striped", full_width = F) %>%
+ group_rows("Group 1", 3, 5, label_row_css = "background-color: #666; color: #fff;")
+```
+
+# Add indentation
+Unlike `group_rows()`, which will insert a labeling row, sometimes we want to list a few sub groups under a total one. In that case, `add_indent()` is probably more apporiate.
+For advanced users, you can even define your own css for the group labeling.
+```{r}
+kable(dt, format = "html") %>%
+ kable_styling("striped", full_width = F) %>%
+ add_indent(c(1, 3, 5))
+```