Mix "color_bar" and "style" in formattable package

Viewed 18

I'm using formattable package and I want to personalize my table but I can't in the way I want.

Here is my table

structure(list(PJ = c(4, 4, 4, 4, 4, 4), V = c(4, 2, 2, 2, 1, 
1), E = c(0, 0, 0, 0, 0, 0), D = c(0, 2, 2, 2, 3, 3), GF = c(182, 
91, 92, 185, 126, 119), GC = c(84, 143, 144, 115, 141, 168), 
    Dif = c(98, -52, -52, 70, -15, -49), Pts = c(12, 6, 6, 6, 
    3, 3)), class = "data.frame", row.names = c("Player1", "Player2", 
"Player3", "Player4", "Player5", "Player6"))

It looks like this:

        PJ V E D  GF  GC Dif Pts
Player1  4 4 0 0 182  84  98  12
Player2  4 2 0 2  91 143 -52   6
Player3  4 2 0 2  92 144 -52   6
Player4  4 2 0 2 185 115  70   6
Player5  4 1 0 3 126 141 -15   3
Player6  4 1 0 3 119 168 -49   3

If I want the column GF in bold, I use

 formattable(TAB.df, list(
    GF = formatter("span",style = style("font.weight"="bold"))
  ))

If I want a color_bar I run this code:

  formattable(TAB.df, list(
    GF = color_bar("lightgreen")
  ))

Nevertheless, I don't know how to combine them and get the "color_bar" with "bold" numbers.

0 Answers
Related