gpt4 book ai didi

r - 可格式化对象的粗体行名称

转载 作者:行者123 更新时间:2023-12-04 20:51:29 26 4
gpt4 key购买 nike

这是我正在使用的格式化对象的最小示例:

library(formattable)
formattable(mtcars,
align = "c",
list(~ formatter("span",
style = x ~ formattable::style(display = "block",
"border-radius" = "2px",
"padding" = "5px",
"text-align" = "center"))))

如何修改它以加粗行名称?

最佳答案

这个怎么样?
我不得不做一个“肮脏的把戏”:我将行名添加为一列,然后将其命名为“”,所以它没有显示......但我认为它可以解决问题:

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")))
)

enter image description here

关于r - 可格式化对象的粗体行名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55426927/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com