Introduction to Shiny


  • Create a file called app.R to make a shiny app.
  • Make sure this file starts with the four key parts of a Shiny app
    • The preamble.
    • The creation of a UI.
    • The creation of a server function with input and output as arguments.
    • A call to run shinyApp() at the end.

The Basics of a User Interface An app about seagrass.


  • We can add text and HTML to our Shiny apps using functions.
  • Shiny has a built-in theming system to make professional looking apps.
  • Our fluid pages are composed of multiple functions that control overall layout.

Inputs and Outputs


  • There are many types of inputs and outputs available for Shiny apps.
  • Inputs follow a basic structure of having a *Input() function with standard arguments in the UI.
  • Outputs have a placeholder in the UI using a *Output() function.
  • Outputs are rendered in the server with a render*() function.
  • The server has two lists to work with - input and output - which contain information for both.

Reactive Objects in Shiny


  • Reactivity is a core to Shiny.
  • To avoid duplicating code, use reactive({}) objects in your server.
  • Use reactive objects to generate dynamic UI elements.

Making Shiny Apps Public


  • Use shinyapps.io in conjunction with Rstudio to make your app public.

Translating a Shiny App


  • Use shi18ny for common/app-related single or a few words across many languages.
  • use shiny.18n to make translation selectors for large chunks of text where you create the dictionary.

Spatial Selection


  • We can use leaflet objects in Shiny.
  • Leaflets by their nature generate inputs when we perform actions.
  • These inputs follow standard naming conventions.
  • We can use these inputs to filter or crop our data to produce more outputs.