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

标签 r shiny

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

干杯。

用户界面

library(shiny)

shinyUI(fluidPage(

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

))

服务器
library(shiny)

shinyServer(function(input, output) {
    ntext <- eventReactive(input$goButton, {
      runApp("benefits")
  })
            })

最佳答案

临时答复:

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

#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")
  )
))

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

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

收听 http://127.0.0.1:7908

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

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

关于runapp从其他带有操作按钮的 Shiny 应用程序中 Shiny ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33592785/

相关文章:

r - 在R中按组添加观察数

python - error install rpy2 : 'sh' is not recognized as an internal or external command, 可运行程序或批处理文件

r - Shiny 的应用程序文件上传 : How can we save the files uploaded on a shiny GUI to a particular destination?

R - Shiny 上的实时图表

shiny - Shiny 数据表的列标题被移动

r - 在 Shiny 中抑制数据表中的排序

r - R 中的索引匹配

将人随机分配到不同大小的组和类别中

r - 在 Shiny 的应用程序中搜索多个 rhandsontable 的功能

r - 如何根据对象索引合并两个列表 - 保持属性?