Developing a single-file Shiny app
Shiny apps probably were one of the most game-changing products developed by RStudio.
These apps, because of their ability to link the analytical environment to the production one, are great instruments in the hands of developers and researchers interested in transforming their work into an actual data-driven product.
In this recipe, I will introduce you to the single-file app, which is becoming the standard for Shiny app development.
When Shiny was first introduced, apps had to be composed of two separate files: one for the user interface and another for the server logic.
Among several refinements and improvements, the RStudio team later introduced a way to produce a Shiny app contained within a single R script. This app is named app.R.
Getting ready
First, we need to install the Shiny package and load it in the R environment:
Install.packages('shiny') library(shiny)
How to do it…
Create an
app.R
file.Add a call to the Shiny package:
library(shiny)
Create a
ui
object...