Home > OS >  conditionally bold values in flextable
conditionally bold values in flextable

Time:10-31

Is it possible to bold/color estimate values based on tstat.

For ex - bold estimate values if tstat is more than 1.96

This is in continuation of enter image description here

CodePudding user response:

Another solution:

library(dplyr)
library(flextable)

set.seed(4123)

attribute <- c("b0", "b1", "b2", "b3", "b4", "b5")
estimate <- round(runif(n = 6, min = 0, max = 5), 2)
tstat <- round(runif(n = 6, min = 0, max = 5), 2)

tbl <- tibble(attribute, estimate, tstat)
  
tbl %>%   
  flextable() %>% 
  bold(tbl$tstat > 1.96,2)

enter image description here

  • Related