Pablo-source/Shiny-app-using-COVID-data

Add Interactive data table below map and time slider bar

Closed this issue · 1 comments

Implement in the next design iteration the following three features in the existing Shiny Dashboard:

Read first about the latest Issue I closed on the 30th August 2024
#16

  1. Using {plotly} library, create a bar chart of total deaths rate by country in descending order, following this script I have used in previous Shiny apps:

       output$ToptenDEATH = renderPlotly({
       Tabledesc1 <- POP_POPULATED  %>%
        select(Death,Country,date) %>% 
        mutate(Max_date = max(POP_POPULATED$date)) %>% 
        mutate(Flag_max_date = ifelse(Max_date == date,1,0)) %>% 
     filter(Flag_max_date==1) %>% 
     arrange(desc(Death)) %>% 
     group_by(date) %>% 
     slice(1:10) %>% 
     ungroup()
    
     TabledesC <- Tabledesc1 %>% 
        arrange(Death)
      Top10_D <- data.frame(TabledesC,stringsAsFactors = FALSE)
      Top10_D$Country <- factor(Top10_D$Country, 
                             levels = unique(Top10_D$Country)[order(Top10_D$Death, decreasing = FALSE)])
    

    Barplot top 10 countries sorted by CONFIRMED cases

        plot_ly(Top10_D, x = ~Death, y = ~Country,
                   type = 'bar', orientation = 'h')%>%
                    layout(title=paste0("Top 10 countries Covid19 Deaths")) })
    
  2. Also include a table with Confirmed, Recovered and Death rates by country, linked to the animated slider imput

      fluidRow(box(dataTableOutput("mytable"), width = 15)
    
  • Server side of the app

  • OUTPUT 03-03 "DATA TABLE"

       output$mytable <- renderDataTable({Tabledesc <- RATESTable()
                                     Tabledesc  %>%
                                     arrange(desc(Confirmed))})
    
  1. Finally, remember to add a legend to the existing Leaflet map built on the previous design iteration.
  • Server side of the app

          ) %>% 
    addLegend( pal = pal_sb, values = dataframe$Deaths,
               position = "bottomleft",
               title = "Total<br/>COVID19<br/>deaths") 
    
  1. Review set of files created by {renv} library created on the previous closed issue

Closed issue as this has been addressed on pull request 19

#19