diff --git a/dashboard.Rmd b/dashboard.Rmd index 8f7d345..c32a6b6 100644 --- a/dashboard.Rmd +++ b/dashboard.Rmd @@ -238,7 +238,7 @@ observe({ }) ``` -Col {data-width=500 .tabset} +Col {data-width=500} ------------------------------------ ### Track Map {.no-padding} @@ -486,37 +486,12 @@ output$track_map <- renderLeaflet({ leafletOutput("track_map", height = "100%") ``` -### Track Data {.no-padding} -```{r} -# Overview - Track Data - -output$track_data <- renderDT({ - datatable( - storm_track() %>% select(datetime, storm_status, lon, lat, rmw, pressure, windspeed, record_identifier), - rownames = F, - colnames = c("Date", "Status", "Lon", "Lat", "RMW", "Pressure", "Windpseed", "Identifier"), - selection = "none", - options = list( - pageLength = 1000, - order = list(0, 'desc'), - searching = F, - paging = F, - info = F, - lengthChange = F, - server = T - ) - ) -}) - -DTOutput("track_data") -``` - -Col {data-width=500} +Col {data-width=500 .tabset} ------------------------------------ -### Normalization Cost Index {data-height=700} +### Normalization and Landfalls {} ```{r} -# Overview - Normalization Chart +# Overview - Normalization and Landfalls storm_yearly_normalization <- reactive({ req(storm_selection$is_selected) @@ -598,28 +573,6 @@ output$cost_index_chart <- renderDygraph({ dyRangeSelector() }) -fluidRow( - style = "height: 100%", - column(3, - virtualSelectInput("storm_overview_cost_index_lf_select", "Landfalls", - choices = NULL, - showValueAsTags = T, - multiple = T, - autoSelectFirstOption = T), - radioGroupButtons("storm_overview_cost_index_scale", label = "Value", choices = c("Index", "Loss"), status = "outline-primary rounded-0", justified = T), - checkboxGroupButtons("storm_overview_cost_index_mmh_mmp", label = "MMH/MMP", choices = c("MMH", "MMP"), selected = c("MMH", "MMP"), status = "outline-primary rounded-0", justified = T), - radioGroupButtons("storm_overview_cost_index_y_scale", label = "Y-Axis Scale", choices = c("Linear", "Log"), status = "outline-primary rounded-0", justified = T) - ), - column(9, - dygraphOutput("cost_index_chart") - ) -) -``` - -### Landfalls {data-height=300 .no-padding} -```{r} -# Overview - Landfalls Table - output$landfalls_table <- renderDT({ req(storm_selection$is_selected) @@ -641,7 +594,56 @@ output$landfalls_table <- renderDT({ formatDate(columns = "datetime", method = "toUTCString") }) -DTOutput("landfalls_table") +fillCol( + flex = c(0.7, 0.3), + div( + fluidRow( + style = "height: 100%", + column(3, + virtualSelectInput("storm_overview_cost_index_lf_select", "Landfalls", + choices = NULL, + showValueAsTags = T, + multiple = T, + autoSelectFirstOption = T), + radioGroupButtons("storm_overview_cost_index_scale", label = "Value", choices = c("Index", "Loss"), status = "outline-primary rounded-0", justified = T), + checkboxGroupButtons("storm_overview_cost_index_mmh_mmp", label = "MMH/MMP", choices = c("MMH", "MMP"), selected = c("MMH", "MMP"), status = "outline-primary rounded-0", justified = T), + radioGroupButtons("storm_overview_cost_index_y_scale", label = "Y-Axis Scale", choices = c("Linear", "Log"), status = "outline-primary rounded-0", justified = T) + ), + column(9, + dygraphOutput("cost_index_chart") + ) + ) + ), + div( + DTOutput("landfalls_table") + ) +) + +``` + +### Track Data {.no-padding} +```{r} +# Overview - Track Data + +output$track_data <- renderDT({ + datatable( + storm_track() %>% select(formatted_datetime, storm_status, lon, lat, rmw, pressure, windspeed), + rownames = F, + colnames = c("Date", "Status", "Lon", "Lat", "RMW", "Pressure", "Windspeed"), + selection = "none", + options = list( + pageLength = 1000, + order = list(0, 'asc'), + searching = F, + paging = F, + info = F, + lengthChange = F, + server = T + ) + ) +}) + +DTOutput("track_data") ``` diff --git a/queries.R b/queries.R index d8a1cdb..28a5af2 100644 --- a/queries.R +++ b/queries.R @@ -295,7 +295,28 @@ get_hurdat_track <- function(storm) { rmw_meters ) - result <- query %>% collect() + result <- query %>% + collect() %>% + mutate( + formatted_datetime = paste0( + format(datetime, "%m/%d/%Y"), + " ", + format(datetime, "%H"), + "Z" + ) + ) %>% + select( + formatted_datetime, + datetime, + storm_status, + lon, + lat, + rmw, + pressure, + windspeed, + record_identifier, + rmw_meters + ) return(result) }