0

If shinydashboard was a person I would like to meet him in a dark alley with a baseball bat. I am simply trying show a data frame as a table in my shiny app so I looked online at a bunch websites and questions on stack exchange and this is what I got.

UI

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

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

I have tried using tableOutput and renderTable I have tried to see if my tib1 was somehow the problem so I tried using the data set mpg. That didnt work. I tried placing DT::dataTableOutput("overviewtable") in a column(), in a fluidRow. I tried reinstalling the packages for DT and refreshing R but that didnt work. I looked at the gallery website from R here. I took that code and ran it and I was able to see their table they made but when I ran my code I cant see my table at all or other tables for that matter. I have a feeling it has something to do with shinydashboard because it seems that when I ran the code from the website above that was just using shiny it worked.

1 Answer 1

2

The problem is a typo in the tabName = argument:

sidebar<-dashboardSidebar( sidebarMenu( menuItem("Overview", tabName ="overview", icon = icon("dashboard")), menuItem("Weather", tabName ="weather", icon = icon("bolt")) ) ) 
Sign up to request clarification or add additional context in comments.

1 Comment

When i would run the code I would get no error message and I would even see both of the tabs but that was indeed the problem. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.