New to the Shiny modules environment, and I am trying to work through the setup of a basic scaffold for separating out the tabbed components of the UI and other's from the ui.r and server.r
Currently I have the following 4 files:
ui.r
navbarPage(id = "main", windowTitle = "Dashboard Title", position =
"fixed-top", header = "Header Text?", title = "Application Logo <To Do>",
navbarMenu("Company Dashboards", icon = icon("dashboard"),
tabPanel(title = "Sales", value = "SalesModule", icon = icon("bar-chart-o"), salesModuleUI("SalesModule")))
server.r
shinyServer(function(input, output, session){
### Modules
callModule(module = salesModule, id = "SalesModule")
})
global.r
#######
# Libraries
#######
library(shiny)
library(shinydashboard)
library(dplyr)
library(highcharter)
library(DT)
#######
# Source Files
#######
source("modules/salesModule.r")
salesModule.r
salesModuleUI <- function(id){
ns <- NS(id)
}
######
# salesDashboard Server
######
salesModule <- function(input,output,session){
ns <- session$ns
}
if I remove the "value = salesModule" and the salesModuleUI call from the ui.r, the application loads fine. As soon as I add those in to populate the tab panel using the salesModuleUI (either UI should be empty right now) I get the error:
Warning: Error in as.character: cannot coerce type 'closure' to vector of type 'character'
I tried reviewing the: r shiny error Error in as.vector(x, "character") : cannot coerce type 'closure' to vector of type 'character'
but this issue appears to be with the reactive call in the code and I have not added reactivity to this yet. I also reviewed: https://github.com/FrissAnalytics/shinyJsTutorials
And his code, this is where the structure for this setup is pulled from.
The coercion issue seems to be fairly common and the fixes revolve around the data type being passed and expectation. However, from I can troubleshoot, the code should be expecting a character vector and I am passing a character vector.
Thoughts on where I am going wrong?