【发布时间】:2021-08-27 22:27:31
【问题描述】:
我有一个要在 R Shiny 中显示的数据表,但我希望标题列的列名称为红色,文本为白色。使用 formatStyles(),我只能指定整个列,而不仅仅是标题名称行。您建议如何解决这个问题?
library(shiny)
library(dplyr)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
),
mainPanel(
DT::DTOutput("table")
)
))
server <- function(input, output) {
data <- tibble(name = c("Justin", "Corey", "Sibley"),
grade = c(50, 100, 100))
output$table <- renderDT({
datatable(data)
})
}
# Run the application
shinyApp(ui = ui, server = server)
【问题讨论】:
-
你的帖子说
column names to be red and the text to be in white.。你想要什么背景色
标签: r shiny formatting dt htmlwidgets