The program structure

Since the first edition of this book, a significant change has taken place with regards to how Shiny applications are structured. A new feature has been added, giving us the ability to place them all within one code file. This is most useful when building small demonstrations or examples for other users, who can just paste the whole code file into the console and have the application run automatically. In order to make use of this functionality, just combine the code from server.R and ui.R, as shown in the following example:

library(shiny) 
server <- function(input, output) { 
  #contents of server.R file 
} 
 
ui <- fluidPage( # or other layout function 
  # contents of ui.R file 
) 
shinyApp(ui = ui, server = server) 

This is useful ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.