tabsetPanel()
- make multiple different output views (i.e. a plot in one tab, a data table in another)helpText()
- create additional text to help users navigate your appletsubmitButton()
- only update outputs when this button is clickedconditionalPanel()
- only show certain UI options when conditions are met (i.e. if a certain tab is open, or a certain input is selected)server <- function(input, output) {
# make output objects from inputs
output$hist <- renderPlot({
# code for plot
})
}
renderDataTable()
- outputs an interactive, sortable data tablerenderPlot()
- output an R plotrenderPrint()
- output text from print() in RrenderTable()
- output an HTML tablerenderText()
- output text from RrenderUI()
- output a custom part of the user interfacerenderImage()
- print an image to the pagehtmlOutput()
- output html elementsserver
functionserver <- function(input, output) {
output$hist <- renderPlot({
dist <- rnorm(n = input$num)
gg <- data.frame(dist) %>%
ggplot(aes(x = dist)) + geom_histogram(binwidth = 0.25) +
xlim(c(-10,10))
print(gg)
})
}
Note the use of curly brackets {
}
in renderPlot
.
The last statement in the code block must be the plot.
For the 01_Hello app:
runApp("02_Reactivity", display.mode = "showcase")
Using your own data or the NYC crime data provided, create a simple Shiny app. Use the NYC_Emergency app as a starting point.
runApp("03_NYC_Emergency")
subset()
and checkboxInput()
to plot user-selected subsetstabsetPanel()
to display different tables/plots