reacti v e e x pression refresher
play

Reacti v e e x pression refresher BU IL D IN G DASH BOAR D S W ITH - PowerPoint PPT Presentation

Reacti v e e x pression refresher BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D L u c y D ' Agostino McGo w an Postdoctoral fello w in Biostatistics at Johns Hopkins Uni v ersit y Inp u ts actionButton() checkboxInput() dateInput()


  1. Reacti v e e x pression refresher BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D L u c y D ' Agostino McGo w an Postdoctoral fello w in Biostatistics at Johns Hopkins Uni v ersit y

  2. Inp u ts actionButton() checkboxInput() dateInput() numericInput() radioButtons() selectInput() sliderInput() textInput() BUILDING DASHBOARDS WITH SHINYDASHBOARD

  3. Inp u ts selectInput() inputId label choices selectInput( inputId = "favorite_character", label = "Favorite Character", choices = c("Leia", "Luke", "Han") ) BUILDING DASHBOARDS WITH SHINYDASHBOARD

  4. Render f u nctions renderPrint() renderText() renderTable() renderDataTable() renderPlot() renderImage() renderUI() BUILDING DASHBOARDS WITH SHINYDASHBOARD

  5. Render F u nctions server <- function(input, output) { output$printed_object <- renderPrint({ "print me" }) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  6. O u tp u t F u nctions renderPrint() -- verbatimTextOutput() , textOutput() renderText() -- textOutput() renderTable() -- tableOutput() renderDataTable() -- dataTableOutput() renderPlot() -- plotOutput() renderImage() -- imageOutput() renderUI() -- uiOutput() BUILDING DASHBOARDS WITH SHINYDASHBOARD

  7. O u tp u t F u nctions renderPrint() -- verbatimTextOutput() , textOutput() render Text () -- text Output() render Table () -- table Output() render DataTable () -- dataTable Output() render Plot () -- plot Output() render Image () -- image Output() render UI () -- ui Output() BUILDING DASHBOARDS WITH SHINYDASHBOARD

  8. O u tp u t F u nctions textOutput() outputId textOutput("printed_object") BUILDING DASHBOARDS WITH SHINYDASHBOARD

  9. Let ' s practice ! BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D

  10. Ser v er - side d y namic ho w- to BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D L u c y D ' Agostino McGo w an Postdoctoral fello w in Biostatistics at Johns Hopkins Uni v ersit y

  11. Read in real time data server <- function(input, output, session) { reactive_data <- reactiveFileReader( intervalMillis = 1000, session = session, filePath = "file.csv", readFunc = read.csv ) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  12. reacti v eFileReader () intervalMillis session filePath readFunc server <- function(input, output, session) { reactive_data <- reactiveFileReader( intervalMillis = 1000, session = session, filePath = "file.csv", readFunc = read.csv ) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  13. Read in real time data server <- function(input, output, session) { ... output$printed_data <- renderPrint({ reactive_data() }) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  14. Let ' s b u ild a d y namic dashboard ! BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D

  15. Optimi z ing performance BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D L u c y D ' Agostino McGo w an Postdoctoral fello w in Biostatistics at Johns Hopkins Uni v ersit y

  16. O u tside the ser v er f u nction load("starwars.Rda") server <- function(input, output) { } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  17. Inside the ser v er f u nction server <- function(input, output) { load("starwars.Rda") } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  18. Inside the ser v er f u nction , inside a reacti v e object server <- function(input, output) { output$my_plot <- renderPlot({ load("starwars.Rda") starwars_sub <- starwars[starwars$height <= input$height, ] hist(starwars_sub$height) }) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  19. Ma y the force be w ith y o u! BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D

  20. UI d y namic ho w- to BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D L u c y D ' Agostino McGo w an Postdoctoral fello w in Biostatistics at Johns Hopkins Uni v ersit y

  21. D y namic Dropdo w n Men u dropdownMenu( type = "messages", messageItem( from = "Lucy", message = "It's a TRAP!"), messageItem( from = "Lucy", message = "Help me, Data Camp, you're my only hope.") ) BUILDING DASHBOARDS WITH SHINYDASHBOARD

  22. msg_df from message 1 Lucy It's a TRAP! 2 Lucy Help me, DataCamp, you're my only hope. BUILDING DASHBOARDS WITH SHINYDASHBOARD

  23. messages <- apply(data, 1, function(row) { messageItem(from = row[["from"]], message = row[["message"]]) }) dropdownMenu(type = "message", .list = messages) BUILDING DASHBOARDS WITH SHINYDASHBOARD

  24. server <- function(input, output) { output$msg_menu <- renderMenu({ messages <- apply(data, 1, function(row) { messageItem(from = row[["from"]], message = row[["message"]]) }) dropdownMenu(type = "message", .list = messages) }) } BUILDING DASHBOARDS WITH SHINYDASHBOARD

  25. header <- dashboardHeader(dropdownMenuOutput("msg_menu")) BUILDING DASHBOARDS WITH SHINYDASHBOARD

  26. D y namic bo x es renderInfoBox() -- infoBoxOutput() renderValueBox() -- valueBoxOutput() BUILDING DASHBOARDS WITH SHINYDASHBOARD

  27. Yo u gi v e it a tr y! BU IL D IN G DASH BOAR D S W ITH SH IN YDASH BOAR D

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend