1 / 18

s hiny in R

s hiny in R. the fundamentals of getting started. What Is It?. New package in R to create web apps Web app built entirely in R, but can also incorporate HTML, CSS, and JavaScript for more flexibility By default, the UI is simple to create and view

darrin
Download Presentation

s hiny in R

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. shiny in R the fundamentals of getting started

  2. What Is It? • New package in R to create web apps • Web app built entirely in R, but can also incorporate HTML, CSS, and JavaScript for more flexibility • By default, the UI is simple to create and view • Built-in widgets for displaying plots, tables, and any other printed output from R

  3. Simple Example > runExample("01_hello")

  4. ui.R & server.R • Two fundamental entities to any Shiny web app • ui.R • Designates the user interface of your app • server.R • Contains all the nuts and bolts of your app

  5. The Flow Start ui.R input$tag output$tag server.R

  6. ui.R in Detail • The three fundamental components of ui.R: • headerPanel() • sidebarPanel() • selectInput() • checkboxGroupInput() • mainPanel()

  7. ui.R Syntax To be memorized!

  8. The Flow Start ui.R input$tag output$tag server.R

  9. Dashboard Example

  10. server.R in Detail – input$tag • input$tag • Whatever options are selected under sidebarPanel() in ui.R is passed to the server.R script • input$dataset becomes either “Products”, “Clients”, or “All data” string, depending on which one the user chooses • input$dataset is reactionary, which means it always changes each time the user decides to select any new value • Beware!! The $ in input$tag here does not refer to any column in the input object tag

  11. server.R in Detail – input$tag(continued) • What does input$dataset do? • Anything you want to do with it

  12. The Flow Start ui.R input$tag output$tag input$dataset = “Products” OR input$dataset = “Clients” OR input$dataset = “All data” server.R

  13. server.R in Detail – output$tag • ‘output’s themselves have tags! • The output is passed to ui.R and recognized under mainPanel() tag tag

  14. server.R Syntax To be memorized!

  15. Summary • User chooses the inputs • Inputs are stored in input$tags • input$tagsare manipulated in server.R • server.R returns output (tables, charts, printed text etc.) in the form of output$tags • The output$tagsfrom server.R is then accepted by ui.R and displayed on the dashboard for the user

  16. Tips • Start small • Keep track of your parentheses • Work on ui.R first • Reference my cheatsheet • github.com/alaneng/personal • Frustration will be commonplace • https://groups.google.com/forum/?fromgroups#!forum/shiny-discuss Check out Glimmer -- host your web app online!

  17. I didn’t understand anything?

  18. I’m for hire! • alanfaieng@gmail.com • linkedin.com/in/alanfaieng • github.com/alaneng/personal • @alanengdata

More Related