1

I am trying to develop my class lecture slides using Shiny apps and ioslides. I would like to have several Shiny apps, each on a different slide to illustrate different concepts. When I naively write the input and render code for an app on a slide, only the first app works and the succeeding apps do not work.

Do I have to shut down the first app before starting the second (and so forth)? I can't seem to find an answer anywhere and I hope someone here can lead me in the right direction. Thanks, in advance.

4

1 回答 1

0

我最近遇到了同样的问题,你必须避免它认为你在同一个演示文稿中制作了不同的闪亮应用程序,因为这个洞文件是一个闪亮的运行时。在这里,您不必显式创建对象“ui”和“serve”

看看这个例子,看看你能不能明白

    ---
    title: "Shiny app - stackoverflow help"
    author: "Johan Rosa"
    date: "August 8, 2018"
    output: ioslides_presentation
    runtime: shiny
    ---   
     ## first slide
                    
        ```{r}
        fluidPage(
           
           # Application title
           titlePanel("Old Faithful Geyser Data"),
           
           # Sidebar with a slider input for number of bins 
           sidebarLayout(
              sidebarPanel(
                 sliderInput("bins",
                             "Number of bins:",
                             min = 1,
                             max = 50,
                             value = 30)
              ),
              
              # Show a plot of the generated distribution
              mainPanel(
                 plotOutput("distPlot")
              )
           )
        )
        ```


    
        ```{r}
        output$distPlot <- renderPlot({
              # generate bins based on input$bins from ui.R
              x    <- faithful[, 2] 
              bins <- seq(min(x), max(x), length.out = input$bins + 1)
              
              # draw the histogram with the specified number of bins
              hist(x, breaks = bins, col = 'darkgray', border = 'white')
           })
        ```

## next slide

#The other app you want toy show, just the way i did it in the first slide
于 2018-08-23T20:04:33.260 回答