Hao Zhu | bacd2f3 | 2017-10-11 14:06:36 -0400 | [diff] [blame^] | 1 | --- |
| 2 | title: "cell_formatter_pdf" |
| 3 | author: "Hao" |
| 4 | date: "10/11/2017" |
| 5 | output: pdf_document |
| 6 | --- |
| 7 | |
| 8 | ```{r, include=F} |
| 9 | library(knitr) |
| 10 | library(kableExtra) |
| 11 | library(dplyr) |
| 12 | ``` |
| 13 | |
| 14 | ```{r} |
| 15 | mtcars[1:5, 1:5] %>% |
| 16 | mutate( |
| 17 | mpg = ifelse(mpg > 21, |
| 18 | cell_spec(mpg, "latex", color = "green", bold = T), |
| 19 | cell_spec(mpg, "latex", color = "red", italic = T)), |
| 20 | rotate = c(60, 120, 180, 240, 300), |
| 21 | rotate = cell_spec(rotate, "latex", angle = rotate) |
| 22 | ) %>% |
| 23 | kable("latex", escape = F, booktabs = T) %>% |
| 24 | row_spec(0, angle = 90) |
| 25 | ``` |