Davie D Davie D -3 years ago 119
R Question

Running R Shiny through RInno Package

I have this Shiny application that I want to run using the RInno package.

Right now my current problem is that after creating the app and then running compile_iss, I get to the setup of the application. Finally, when the application is launching it gives me the following error:

ERROR: Can't call `runApp()` from within `runApp()`. If your application code contains `runApp()`, please remove it.

My application does not contain
anywhere inside of it.

I have included this code at the end:

session$onSessionEnded(function() {

I end my shiny app with:

shinyApp(ui = ui, server = server)

Does anyone know how I can resolve that error?

Added Code:

ui <- fluidPage(
selectInput("type", "Select Type of Record:",
choices=c('A', 'B', 'C'),
DT::dataTableOutput("responses", width = 300), tags$hr(),
textInput("Comment", "Comments:", ""),
actionButton("submit", "Submit")),

server <- function(input, output, session) {
mydata <- reactive({
invalidateLater(30 * 60000,session)
odbcChannel<- odbcConnect("a", uid, pwd)
message <- sqlQuery(odbcChannel, "select a, b,c
from table
#I got rid of all the other stuff, as I figured it was unimportant. Let me know if you need to see more


session$onSessionEnded(function() {


Answer Source

RInno is designed to call runApp() during the app's startup sequence before any of the app's code is run. shinyApp(ui = ui, server = server) is trying to start the app a second time.

A good pre-compile_iss check is to run runApp("path to ui.R/server.R") because that is exactly how RInno tries to start the app

If you delete shinyApp(ui = ui, server = server) from your app, it should fix the error, but let me know if you are still having an issue and I would be happy to troubleshoot it with you!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download