Here's a minimal example of the formattable object I'm working with:
library(formattable)
formattable(mtcars,
align = "c",
list(~ formatter("span",
style = x ~ formattable::style(display = "block",
"border-radius" = "2px",
"padding" = "5px",
"text-align" = "center"))))
How can I modify it to bold the row names?
How about this? I had to do a "dirty trick": I add row names as a column and then named it as " " so it is not shown... But i think it makes the trick:
library(formattable)
mtcars$model <- rownames(mtcars)
rownames(mtcars) <- c()
mtcars <-mtcars[,c(12,c(1:11))]
colnames(mtcars)[1] = " "
formattable(mtcars,
align = "c",
list(~ formatter("span",
style = x ~ formattable::style(display = "block",
"border-radius" = "2px",
"padding" = "5px",
"text-align" = "center")),
` ` = formatter("span",style = ~ style(display = "block",
"border-radius" = "2px",
"padding" = "5px",
"font.weight" = "bold",
"text-align" = "left")))
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With