从运行的shinyapp中调用shinyapp作为函数保存

时间:2016-09-21 19:25:07

标签: r shiny

我有一个正在运行的shinyapp(myapp),它在运行期间会创建一个对象,可以在另一个shinyapp(fun.app)的argin中用作保存为进一步分析的函数。

如何从myapp调用fun.app?

这是问题的玩具示例

fun.app <- function(df){shinyApp(
 ui = fluidPage(
numericInput("n", "n", 1),
plotOutput("plot")
),
server = function(input, output) {
  output$plot <- renderPlot( plot(df, input$n)) 
}
)}

shinyApp(
 ui = fluidPage(
  actionButton('go','push me')
),
server = function(input, output) {
observeEvent(input$go,{
  runApp(fun.app(cars))
})
})

我收到此错误

Listening on http://127.0.0.1:6039 
Warning: Error in handlers$add: Key / already in use 
Stack trace (innermost first): 
70: handlers$add 
69: handlerManager$addHandler 
68: startApp 
67: runApp 
66: observeEventHandler [#7] 
4: <Anonymous> 
3: do.call 
2: print.shiny.appobj 
1: <Promise> 

0 个答案:

没有答案