簡體   English   中英

數據表在閃亮儀表板中不起作用

[英]Data table will not work in shinydashboard

如果shinydashboard 是一個人,我想在黑暗的小巷里拿着棒球棒見到他。 我只是想在我的 shiny 應用程序中將數據框顯示為表格,所以我在網上查看了一堆網站和有關堆棧交換的問題,這就是我得到的。

用戶界面

library(shiny)
library(shinydashboard)
library(data.table)#For fread.
library(tidyverse)
library(htmlwidgets)
library(DT)#For the interactive table.


# Header -----------------------------------------------------------------------|
header<-dashboardHeader( title = "Marketing Dashboard"
  
)


# Sidebar ----------------------------------------------------------------------|

sidebar<-dashboardSidebar(
  sidebarMenu(
    menuItem("Overview", tabname ="overview", icon = icon("dashboard")),
    menuItem("Weather", tabname ="weather", icon = icon("bolt"))
  )
)

# Body -------------------------------------------------------------------------|
  
body<-dashboardBody( 
  tabItems(
    tabItem(tabName = 'overview',
        DT::dataTableOutput("overviewtable")
    ),
    tabItem(tabName = 'weather',
      fluidRow(
        
      )
    )
  )
)



# UI ---------------------------------------------------------------------------|

ui = dashboardPage(
  header,
  sidebar,
  body
)

shinyApp(ui,server)

服務器

server <- function(input,output){
  
  #Table for overview
  output$overviewtable<- DT::renderDataTable({
    DT::datatable(tib1)
  })
  
}

我嘗試使用tableOutputrenderTable我嘗試查看我的tib1是否存在某種問題,所以我嘗試使用數據集mpg 那沒有用。 我嘗試將DT::dataTableOutput("overviewtable")放在一個 column() 中,在一個 FluidRow 中。 我嘗試重新安裝DT的軟件包並刷新 R 但這沒有用。 我從 R here查看了畫廊網站。 我拿了那個代碼並運行它,我能夠看到他們制作的表格,但是當我運行我的代碼時,我根本看不到我的表格或其他表格。 我覺得它與 shinydashboard 有關,因為似乎當我從上面的網站運行代碼時,它只是使用 shiny 它工作。

問題是tabName =參數中的錯字:

sidebar<-dashboardSidebar(
  sidebarMenu(
    menuItem("Overview", tabName ="overview", icon = icon("dashboard")),
    menuItem("Weather", tabName ="weather", icon = icon("bolt"))
  )
)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM