require("shiny")
# Global variables can go here
n <- 200
# Define the UI
ui <- bootstrapPage(
numericInput('n', 'Number of obs', n),
plotOutput('plot')
)
# Define the server code
server <- function(input, output) {
output$plot <- renderPlot({
hist(runif(input$n))
})
}
# Return a Shiny app object
cat("before\n")
shinyApp(ui = ui, server = server)
cat("After\n")
You have to have shinyApp as the last line; it needs to be the thing that's returned when Shiny calls source() on your file.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/0809192d-2ca3-4cea-a7a8-5a871620658c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Oh sorry, I didn't see that you were sourcing the file. Normally we intend that you name the file app.R and call shiny::runApp(), passing it the directory in which app.R lives. This gives you the advantage of editing the app.R and hitting Reload in your browser without restarting Shiny.
If you really want to source it this way, put a print() or runApp() call around your shinyApp() call. That should launch it.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/07995f1d-943b-461f-b94c-c0647c2579dc%40googlegroups.com.