Created
April 3, 2020 18:06
-
-
Save ChrisBeeley/cfddc35235f6119c326d7f70e8ad9120 to your computer and use it in GitHub Desktop.
Test to see how app.R behaves the first time it runs and on subsequent runs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(tidyverse) | |
library(DT) | |
load("ae_attendances.RData") | |
Sys.sleep(10) | |
# filter to random 10 Trusts with a decent amount of data in | |
sample_trusts <- ae_attendances %>% | |
group_by(Name) %>% | |
count() %>% | |
ungroup() %>% | |
filter(n > 50) %>% | |
sample_n(10) %>% | |
pull(Name) | |
ae_attendances <- ae_attendances %>% | |
filter(Name %in% sample_trusts) | |
ui <- fluidPage( | |
# Application title | |
titlePanel("A and E data"), | |
sidebarLayout( | |
sidebarPanel( | |
selectInput("trust", | |
"Select Trust", | |
choices = unique(ae_attendances$Name)) | |
), | |
mainPanel( | |
DT::dataTableOutput("trustTable") | |
) | |
) | |
) | |
server <- function(input, output) { | |
output$trustTable <- DT::renderDataTable({ | |
ae_attendances %>% | |
filter(Name == input$trust) | |
}) | |
} | |
# Run the application | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment