Runapp brilliant from another brilliant app with action button

I try to call another shinny application when I press the action button in a very simple brilliant application. Another application is in the folder with the privileges of the ui.R and server.R files, but when I click the button, nothing happens. Is it possible that I'm trying to do?

Greetings.

ui.R

library(shiny)

shinyUI(fluidPage(

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

))

server.R

library(shiny)

shinyServer(function(input, output) {
    ntext <- eventReactive(input$goButton, {
      runApp("benefits")
  })
            })
+4
source share
2 answers

TEMPORARY RESPONSE:

I began to search for an answer to this problem. This answer will be updated on time.

#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

$add (, , ): /

. , .

+1

. runApp() ,

Warning: Error in shiny::runApp: Can't call 'runApp()' from within 'runApp()'. If your application code contains 'runApp()', please remove it.

, RStudio 1.2 . runApp() R runApp() R Studio. .

:

script.R

shiny::runApp(path_to_app, launch.browser = TRUE, port = 875)

ui.R

actionButton("launch_app", "Launch second Shiny App")

server.R

observeEvent(input$launch_app, {
        rstudioapi::jobRunScript(path = path_to_script)
    })

, inst/ system.file() .

0

Source: https://habr.com/ru/post/1614925/


All Articles