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:
fluidPage()
- layout function to set up visual structure of pageselectInput()
- input control for user to interact withverbatimTextOutput()
- output control - shows code resulttableOutput()
- output control - displays tables
These are all just ways to generate HTML
Run the following in the console to see the outputted html:
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.