4

I have several shiny apps, and now I want to create a dashboard for these apps. I don't want to change the original apps.Just want to create another ui.R and server.R. And integrate the other apps into it. Like the following structure.

#ui.R
ui <- dashboardPage(
  dashboardHeader(title = "App User Analyse"),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
      menuItem("Widgets", tabName = "widgets", icon = icon("th"))
    )
  ),



dashboardBody(
    tabItems(
      # First tab content
      tabItem(tabName = "Dashboard",
             ***app1***
      ),

      # Second tab content
      tabItem(tabName = "widgets",
              ***app2***
      )
    )
  )
)

I'm new to shiny and shiny server. I'm not sure if there is a way to achieve this. If yes, could any one give me a small example? Thank you!

ysfseu
  • 666
  • 1
  • 10
  • 20
  • Create a simple website with links to different shiny apps? – zx8754 Jul 23 '15 at 08:14
  • 1
    I asked the same question yesterday and two methods are recommended, iframe and Shiny modules. Both worked. http://shiny.rstudio.com/articles/modules.html – John Mar 30 '16 at 02:55

1 Answers1

2

My first instinct is that you can't simply copy all the apps code into one place and expect it to work, you'll have to do a little bit of work to integrate them all together. For example, if two of your apps have an input field with id "foo", then you can't have both of them unchanged in one shinydashboard app because you cannot have multiple elements with the same id. This is just a very simple example of why you can't simply concatenate all the code together.

DeanAttali
  • 25,268
  • 10
  • 92
  • 118
  • Thank you for your remind. But in my case, I'm sure the codes from these apps can work together well .But the point is that I don't want to copy all the file into a single file. Just want to reuse the apps. Based on this fact, could you give some advice? Thanks again – ysfseu Jul 23 '15 at 08:34
  • 2
    Then you can split the ui and the server code of each file into two files, and just `source()` each ui and server component into the main app. That might work (using a similar approach to this one http://stackoverflow.com/questions/30534674/displaying-true-when-shiny-files-are-split-into-different-folders) – DeanAttali Jul 23 '15 at 16:32
  • Thank you ! And your link also solved the "TRUE" problem for me ! – ysfseu Jul 24 '15 at 01:22