Hao Zhu | 9ce317e | 2017-10-12 18:19:55 -0400 | [diff] [blame] | 1 | --- |
| 2 | title: "cell_formatter_pdf" |
| 3 | author: "Hao" |
| 4 | date: "10/11/2017" |
| 5 | output: html_document |
| 6 | --- |
| 7 | |
| 8 | ```{r, include=F} |
| 9 | library(knitr) |
| 10 | library(kableExtra) |
| 11 | library(dplyr) |
| 12 | ``` |
| 13 | |
| 14 | ```{r} |
| 15 | mtcars[1:15, 1:5] %>% |
| 16 | mutate( |
| 17 | mpg = cell_spec(mpg, "html", color = "white", background = spec_color(mpg)), |
| 18 | disp = cell_spec(disp, "html", color = spec_color(disp, option = "B"), |
| 19 | bold = T, font_size = spec_font_size(disp)), |
| 20 | hp = cell_spec(hp, "html", hover_message = paste0("cyl:\n", cyl)) |
| 21 | ) %>% |
| 22 | kable("html", escape = F) %>% |
| 23 | kable_styling("condensed", full_width = F) |
| 24 | ``` |