blob: 48cc723d3e10b7c5bdb06e0be22f339110990461 [file] [log] [blame]
Hao Zhu68449202018-10-16 16:01:19 -04001---
2title: "Using kableExtra in Radix"
3description: |
4 A new article describing how to use kableExtra in Radix
5author:
6 - name: Hao Zhu
7 url: https://github.com/haozhu233
8date: "`r Sys.Date()`"
9output: radix::radix_article
10---
11
12People may find some features in `kableExtra`, such as hovering/striped rows are not working in `radix`. The reason is that `kableExtra` relies on `bootstrap` stylesheet to do these jobs while `radix` doesn't have those css load. Therefore you need to tell `kableExtra` to load the table css for you by setting `options(kableExtra.html.bsTable = T)`.
13
14```{r, echo = T}
15library(kableExtra)
16options(kableExtra.html.bsTable = T)
17
18kable(iris[1:6, ], caption = "kable with kableExtra") %>%
19 kable_styling(c("striped", "hover", "condensed"), full_width = F,
20 position = "left") %>%
21 add_header_above(c("numerical" = 4, "categorical" = 1)) %>%
22 column_spec(1, bold = T) %>%
23 row_spec(0, italic = T)
24```
25
26
27Comparing with other table options
28
29```{r, echo = T}
30kable(iris[1:6, ], caption = "Basic kable")
31```
32
33```{r, echo = T}
34rmarkdown::paged_table(iris)
Hao Zhu6e631882018-10-16 16:33:10 -040035```
36
37# Appendix
38Here is a screenshot of how table looks like if you don't turn on the `kableExtra.html.bsTable` option (with the same code). In fact, the only part that breaks is the `striped` and `hover` option. :P
39
40![](radix_no_bs.png)