# NOT RUN {
highlight_cells(mtcars, rows = hp > 230 | qsec > 20)
highlight_cells(mtcars, rows = hp > 230, columns = 'hp')
# }
# NOT RUN {
library(dplyr); library(tibble); library(pander)
mtcars %>%
highlight_cells(rows = hp > 230, columns = 'hp') %>%
highlight_cells(rows = qsec > 20, columns = 'qsec', left = '<b style="color:blue;">') %>%
rownames_to_column('car') %>%
data.frame(stringsAsFactors = FALSE, check.names = FALSE) %>%
pander::pander(split.tables = Inf, justify = alignment(.))
# }
# NOT RUN {
# }
# NOT RUN {
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse, magrittr)
set.seed(10)
data_frame(
w = paste(constant_months, rep(2016:2017, each = 12))[1:20] ,
x = rnorm(20, 200000, 75000)
) %>%
{
a <- .
rbind(
a,
a %>%
mutate(w = 'Total') %>%
group_by(w) %>%
summarize(x = sum(x))
)
} %>%
mutate(
y = f_denom(x, prefix = '$'),
z = f_denom(x, mix.denom = TRUE, prefix = '$'),
x = f_comma(f_dollar(x, 2))
) %>%
highlight_cells(w == 'Total') %>%
data.frame(stringsAsFactors = FALSE, check.names = FALSE) %>%
pander::pander(split.tables = Inf, justify = alignment(.))
# }
Run the code above in your browser using DataLab