I am using shiny
and shinydashboard
to create a dashboard. The minimum example codes are as below:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "test"),
dashboardSidebar(
sidebarMenu(
menuItem(text = "Tab One",tabName = "tab1"),
menuItem(text = "Tab Two",tabName = "tab2"),
id = "sidebar"), # an extra comma here!
),
dashboardBody()
)
server <- function(input,output){}
shinyApp(ui,server)
When I run this App, there is an error message:
Error in tag("section", list(...)) : argument is missing, with no default
I know I got this error because I have an extra comma at the end of line 10. But the problem is that:
I have a similar error in my app, but the app contains more than 20 different R files sourcing each other and more than 2000 lines of code. It's impossible for me to go over each file and try to spot where I put an extra comma.
My question is:
Is there an easier way to let R print error message with line number and file source? Or is there a better way to debug this kind of errors where no detail is provided? Thanks!
Ideally, I want the error message to be something similar to this:
Error in source: <folder>/<file.R> 9:10: argument is missing, with no default
9: menuItem(text = "Tab Two",tabName = "tab2"),
10: id = "sidebar"), # an extra comma here!
^