runapp从其他带有操作按钮的闪亮应用程序中闪亮

mah*_*sip 5 r shiny

当我在一个非常简单的闪亮应用程序中按下操作按钮时,我试图调用另一个闪亮的应用程序。另一个应用程序位于一个带有 ui.R 和 server.R 文件的名为 Benefits 的文件夹中,但是当我单击该按钮时,什么也没有发生。有可能我正在尝试做什么吗?

干杯。

用户界面

library(shiny)

shinyUI(fluidPage(

  # Application title
  titlePanel("RunnApp"),
    mainPanel(
      actionButton("goButton", "Go!")
    )

))
Run Code Online (Sandbox Code Playgroud)

服务器

library(shiny)

shinyServer(function(input, output) {
    ntext <- eventReactive(input$goButton, {
      runApp("benefits")
  })
            })
Run Code Online (Sandbox Code Playgroud)

Inf*_*ess 1

临时答复:

我已经开始寻找这个问题的答案。本回答会及时更新。

#server.R



library(shiny)

shinyServer(function(input, output) {
  ntext <- eventReactive(input$goButton, {
    stopApp(runApp('C:/Users/Infinite Flash/Desktop/Dashboard'))
  })

  output$nText <- renderText({
    ntext()
  })
})



#ui.R

library(shiny)

shinyUI(pageWithSidebar(
  headerPanel("actionButton test"),
  sidebarPanel(
    actionButton("goButton", "Go!"),
    p("Click the button to update the value displayed in the main panel.")
  ),
  mainPanel(
    textOutput("nText")
  )
))
Run Code Online (Sandbox Code Playgroud)

这段代码的伟大之处在于它初始化了我用 stop(runApp('C:/Users/Infinite Flash/Desktop/Dashboard'))语句指定的应用程序。我可以验证它是否运行该应用程序,因为我在该应用程序中有一个 global.R 文件,该文件有 6 个预加载的数据集,应用程序需要在启动之前加载这些数据集。我知道它运行了,因为在这行代码运行之后,这些对象(由引用的应用程序中的 global.R 文件创建)位于我的环境中。

棘手的问题是,当我初始化引用的应用程序时(我认为这就是问题所在),我会收到此错误:

收听http://127.0.0.1:7908

handlers$add(handler, key, tail) 中的错误:密钥/已在使用中

目前,这种闪亮界面的错误超出了我的知识范围。要调试此错误,我需要进行调查。