The UI and server

Each R Shiny application consists of two primary sections, which are the UI section and the server section. The UI, as the name suggests, is used to define the user interface, whereas the server section is used for executing the underlying R server side code. The shinyApp function is used in order to launch the application using the ui and server definitions.

The UI object holds the R Shiny widgets used to prepare the frontend components that the user will interact with while using the application.

A few toy examples have already been included as part of the RStudio programming environment. In order to launch an R Shiny application, run the following code in RStudio:

library(shiny)runExample("01_hello")

This will launch ...

Get Hands-On Data Science with R 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.