如何在闪亮的仪表板中使用多个 slickROutput

How to use multiple slickROutput in shiny dashboard

我正在尝试创建一个网页,我必须在其中显示多个幻灯片。我找到了一种在 R 中使用 slickR 包来显示幻灯片的方法,但我无法显示多个。这是我试图渲染两个 slickR 的代码,我不知道我在做什么 wrong.Please 帮助我只是一个初学者。

代码:

library(shiny)
library(slickR)

ui <- fluidPage(
     column(12,column(6, slickROutput("slickr", width="200px")),
     column(6,slickROutput("slickr1",width = "200px")))
)

server <- function(input, output) {
  output$slickr <- renderSlickR({
    imgs <- list.files("D:/Projects/Rdashboards/Images/1/", pattern=".png", full.names = TRUE)
    slick <- slickR(imgs)
    slick + settings(autoplay = TRUE,autoplaySpeed = 1000)
  })

  output$slickr1 <- renderSlickR({
    imgs1 <- list.files("D:/Projects/Rdashboards/Images/2/", pattern=".png", full.names = TRUE)
    slick1 <- slickR(imgs1)
    slick1 + settings(autoplay = TRUE,autoplaySpeed = 1000)
  }) 
}

shinyApp(ui = ui, server = server)

您可以简单地为每个输出指定一个不同的 slideID 名称,如下所示:

  output$slickr <- renderSlickR({
    imgs <- list.files("D:/Projects/Rdashboards/Images/1/", pattern=".png", full.names = TRUE)
    slick <- slickR(imgs, slideID = "sld1")
    slick + settings(autoplay = TRUE,autoplaySpeed = 1000)
  })

  output$slickr1 <- renderSlickR({
    imgs1 <- list.files("D:/Projects/Rdashboards/Images/2/", pattern=".png", full.names = TRUE)
    slick1 <- slickR(imgs1, slideID = "sld2")
    slick1 + settings(autoplay = TRUE,autoplaySpeed = 1000)
  })