blob: e56a260efe5772a699f9ab9d96fda46a12c80bce [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
Hao Zhu064990d2017-10-17 18:08:42 -04008<script>
9 $( function() {
10 $( document ).tooltip();
11 } );
12</script>
13
14
15<div><div class = "tooltip">sss</div>ssa</div>
Hao Zhu9ce317e2017-10-12 18:19:55 -040016```{r, include=F}
17library(knitr)
18library(kableExtra)
19library(dplyr)
20```
21
22```{r}
23mtcars[1:15, 1:5] %>%
24 mutate(
25 mpg = cell_spec(mpg, "html", color = "white", background = spec_color(mpg)),
26 disp = cell_spec(disp, "html", color = spec_color(disp, option = "B"),
27 bold = T, font_size = spec_font_size(disp)),
Hao Zhu064990d2017-10-17 18:08:42 -040028 hp = cell_spec(hp, "html", tooltip = paste0("cyl:\n", cyl))
Hao Zhu9ce317e2017-10-12 18:19:55 -040029 ) %>%
30 kable("html", escape = F) %>%
31 kable_styling("condensed", full_width = F)
32```
Hao Zhu457acb42017-10-14 17:37:02 -040033
34```{r}
35iris[, 1:4] %>%
36 mutate_all(function(x){
37 cell_spec(x, "html",
38 color = spec_color(x, option = "A"),
39 font_size = spec_font_size(x),
Hao Zhu064990d2017-10-17 18:08:42 -040040 bold = T, tooltip = "1")
Hao Zhu457acb42017-10-14 17:37:02 -040041 }) %>%
42 kable("html", escape = F, booktabs = T, linesep = "", align = "c")%>%
43 row_spec(0, angle = 270, align = "right") %>%
44 kable_styling(full_width = F)
45```