anderwyang
anderwyang

Reputation: 2451

In r/formattable, how to make `total` row in bold and size=8

In r/formattable, how to make total row in bold and size=8 ?

library(formattable)
df <- data.frame(category=c('a','b','total'),value=c(1,2,3))
formattable(df,list(
  category = formatter("span",
                       style = x ~ style(color = "red")
                       )
  ))

Upvotes: 0

Views: 586

Answers (1)

Quinten
Quinten

Reputation: 41601

You could use the following formatter like this:

library(formattable)
lg_bold_color_size <- formatter("span", style = ~style("font.weight" = "bold", "font.size" = "8", 'color' = 'red'))
df <- data.frame(category=c('a','b','total'),value=c(1,2,3))
formattable(df, list(area(row = 3) ~ lg_bold_color_size)) 

enter image description here

Created on 2022-09-30 with reprex v2.0.2

Upvotes: 0

Related Questions