1.4 Adding UI controls

Replace the ui in your app with this code that shows you all the built-in data frames in the datasets package.

ui <- fluidPage(
  selectInput("dataset", label = "Dataset", choices = ls("package:datasets")),
  verbatimTextOutput("summary"),
  tableOutput("table")
)

Four new functions:

  1. fluidPage() - layout function to set up visual structure of page
  2. selectInput() - input control for user to interact with
  3. verbatimTextOutput() - output control - shows code result
  4. tableOutput() - output control - displays tables

These are all just ways to generate HTML

Run the following in the console to see the outputted html:

selectInput("dataset", label = "Dataset", choices = ls("package:datasets"))

Open the app in the browser, right click on page >> select inspect to see the html.

Note: fluidPage() is just one option available for page setup. navBarPage() is a nice example for creating an app with page tabs.

You can see an example of the use of navBarPage() here.