Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecy ∙ Data-Driven Management Lecture 12 Building Shiny Apps.

Similar presentations


Presentation on theme: "Lecy ∙ Data-Driven Management Lecture 12 Building Shiny Apps."— Presentation transcript:

1 Lecy ∙ Data-Driven Management Lecture 12 Building Shiny Apps

2 https://github.com/lecy/shiny # install.packages( "shiny" ) library( shiny ) runGitHub( repo="shiny", username="lecy") RUN A SHINY APP FROM GITHUB:

3 ANATOMY OF A SHINY APP Two main files: server.R ui.R User interface: Sidebar Panels – used to gather input Main Panel – used for tables and graphs Titles – label panels and output

4 STANDARD SHINY WIDGETS (INPUTS) Function NameWidget actionButtonAction Button checkboxGroupInputA group of check boxes checkboxInputA single check box dateInputA calendar to aid date selection dateRangeInputA pair of calendars for selecting a date range fileInputA file upload control wizard helpTextHelp text that can be added to an input form numericInputA field to enter numbers radioButtonsA set of radio buttons selectInputA box with choices to select from sliderInputA slider bar submitButtonA submit button textInputA field to enter text Note each function will store different input values: textInput = a single character element selectInput = character elements from a list sliderInput = two numbers in a range checkboxInput = T / F

5 WIDGET COMPONENTS Name for the widget. The user will not see this name, but you can use it to access the widget’s value. The name should be a character string. Label. This label will appear with the widget in your app. It should be a character string, but it can be an empty string "". actionButton( “submit", label = “Submit Your Form") How you will access the data on server.R: Input$name Creates an entry at Input$submit

6 Output FunctionCreates htmlOutputraw HTML imageOutputimage plotOutputplot tableOutputtable textOutputtext uiOutputraw HTML verbatimTextOutputtext OUTPUT FUNCTIONS: The output functions take R code and “render” it as HTML objects that can be used in web browsers in order to display your dashboard. They just translate from R to HTML.

7 ANATOMY OF A SHINY APP: DATA FLOW ui.R Input widgets Output functions server.R Load data Load packages Conduct analysis – generate tables and graphs collect parameters send rendered objects back to UI


Download ppt "Lecy ∙ Data-Driven Management Lecture 12 Building Shiny Apps."

Similar presentations


Ads by Google