繁体   English   中英

如何在闪亮的仪表板中使用R包“formattable”?

[英]How to use R package “formattable” in shiny dashboard?

以下是我编写的代码。 我无法在我的闪亮中使用formattable formattable有助于格式化表格并改善可视化效果。

library("shinydashboard")
library("shiny")
library("formattable")

body <- dashboardBody(
  fluidRow(
    column(width = 12,
           box(tableOutput(formattable(test.table, list())))
           )
    )
  )

ui <- dashboardPage(
  dashboardHeader(title = "Column layout"),
  dashboardSidebar(),
  body
)

server <- function(input, output) {

  test.table <- data.frame(lapply(1:8, function(x) {1:10}))

    output$table <- renderTable({test.table})
}
shinyApp(ui = ui, server = server)

你必须使用renderFormattable,formattableOutput和formattable,这三个都可以使用它

library("shinydashboard")
library("shiny")
library("formattable")

body <- dashboardBody(
 fluidRow(
   column(width = 12,
        box(formattableOutput("table"))
   )
 )
)

ui <- dashboardPage(
    dashboardHeader(title = "Column layout"),
    dashboardSidebar(),
    body
 )

 server <- function(input, output) {

    test.table <- data.frame(lapply(1:8, function(x) {1:10}))

    output$table <- renderFormattable({formattable(test.table, list())})
}
shinyApp(ui = ui, server = server)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM