Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Using shiny modules and shinydashboard: shiny.tag error

$
0
0

I'm trying to create and use shiny modules inside a shinydashboard app but I keep getting this error:

Error in FUN(X[[i]], ...) : Expected an object with class 'shiny.tag'.

Here is the app as condensed as possible:

ui.r

library(shiny)
library(shinydashboard)

source("modules.r")

ui <- dashboardPage(
 dashboardHeader(
  title = "Shiny modules and shinydashboard"
 ),

 dashboardSidebar(
  sidebarMenu(
   menuItem("PointA") 
  )
 ),

 dashboardBody(
  tabItems(
   fooUI("myid") 
  )
 )
)

server.r

server <- function(input, output) {
 callModule(foo, "myid") 
}

modules.r

fooUI <- function(id) {
 ns <- NS(id)

 tagList(
  tabItem(
   tabName = "PointA",
   textOutput(ns("text"))
  )
 )
}

foo <- function(input, output, session){

 output$text <- renderText(
  rnorm(1)
 )
}

What am I doing wrong? I got other kinds of modules to work in a "normal" shiny app, however, whenever I try to use a module within shinydashboard it fails.

I am using the newest version of R, shiny and shinydashboard. This is not the issue here.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>