blob: fb645ad039f7369188b91a6479cf9dc9ae6240bc [file] [log] [blame]
Hao Zhu9ce317e2017-10-12 18:19:55 -04001---
2title: "cell_formatter_pdf"
3author: "Hao"
4date: "10/11/2017"
5output: html_document
6---
7
8```{r, include=F}
9library(knitr)
10library(kableExtra)
11library(dplyr)
12```
13
14```{r}
15mtcars[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```
Hao Zhu457acb42017-10-14 17:37:02 -040025
26```{r}
27iris[, 1:4] %>%
28 mutate_all(function(x){
29 cell_spec(x, "html",
30 color = spec_color(x, option = "A"),
31 font_size = spec_font_size(x),
32 bold = T)
33 }) %>%
34 kable("html", escape = F, booktabs = T, linesep = "", align = "c")%>%
35 row_spec(0, angle = 270, align = "right") %>%
36 kable_styling(full_width = F)
37```