Download presentation
Presentation is loading. Please wait.
Published byTeresa Hey Modified over 10 years ago
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 2
3
Simple Example > runExample("01_hello") 3
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 4
5
The Flow ui.R input$tag server.R output$tag Start 5
6
ui.R in Detail The three fundamental components of ui.R: headerPanel() sidebarPanel() selectInput() checkboxGroupInput() mainPanel() 6
7
ui.R Syntax To be memorized! 7
8
The Flow ui.R input$tag server.R output$tag Start 8
9
Dashboard Example 9
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 10
11
server.R in Detail – input$tag (continued) What does input$dataset do? Anything you want to do with it 11
12
The Flow ui.R input$tag server.R output$tag Start 12 input$dataset = “Products” OR input$dataset = “Clients” OR input$dataset = “All data”
13
server.R in Detail – output$tag ‘output’s themselves have tags! The output is passed to ui.R and recognized under mainPanel() tag 13
14
server.R Syntax To be memorized! 14
15
Summary User chooses the inputs Inputs are stored in input$tags input$tags are manipulated in server.R server.R returns output (tables, charts, printed text etc.) in the form of output$tags The output$tags from server.R is then accepted by ui.R and displayed on the dashboard for the user 15
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! 16
17
I didn’t understand anything ? 17
18
I’m for hire! alanfaieng@gmail.com linkedin.com/in/alanfaieng github.com/alaneng/personal @alanengdata 18
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.