The file app.R
in my working directory contains a Shiny app:
shinyApp(
ui = fluidPage(
textInput("name", "Write your name", value = "stranger"),
verbatimTextOutput("greeting")
),
server = function(input, output) {
output$greeting <- renderPrint({
greeting <- paste("Hi,", input$name)
greeting
})
}
)
I want to call this app from within a function in R, then exit the app and have R execute the rest of the function. The function looks like this:
hi.app <- function() {
library(shiny)
shiny::runApp("app.R")
print("Finished.")
}
The app opens upon running hi.app()
, but when I close the app's window, the function calls the debugger:
Called from: Sys.sleep(0.001)
Desired behaviour:
- Run
hi.app()
- Close app window
- print
[1] "Finished"