mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
remove static county data table
This commit is contained in:
+53
-40
@@ -949,65 +949,78 @@ output$test_dy <- renderDygraph({
|
|||||||
```
|
```
|
||||||
|
|
||||||
### County Data {data-height=450 .no-padding}
|
### County Data {data-height=450 .no-padding}
|
||||||
```{r}
|
```{r include=FALSE}
|
||||||
# Growth - County Table
|
# Growth - County Table
|
||||||
great_miami_data <- data.frame(
|
|
||||||
county_name = c(
|
output$county_growth_dt <- renderDT({
|
||||||
"Broward County",
|
req(growth_counties, input$growth_trend_map_slider, storm_selection$is_selected)
|
||||||
"Collier County",
|
|
||||||
"Miami-Dade County",
|
base_year <- storm_selection$storm_year
|
||||||
"Monroe County"
|
current_year <- input$growth_trend_map_slider
|
||||||
),
|
|
||||||
housing_1926 = c(3.7, 0, 25, 3.5),
|
# Get county names
|
||||||
housing_2024 = c(869, 250, 1100, 55),
|
county_names <- public.counties %>%
|
||||||
population_1926 = c(14, 0, 103, 16),
|
select(statefp, countyfp, namelsad) %>%
|
||||||
population_2024 = c(2100, 428, 2990, 81)
|
collect()
|
||||||
|
|
||||||
|
county_data <- growth_counties() %>%
|
||||||
|
st_drop_geometry() %>%
|
||||||
|
filter(year %in% c(base_year, current_year)) %>%
|
||||||
|
left_join(
|
||||||
|
county_names,
|
||||||
|
by = c("state_fips" = "statefp", "county_fips" = "countyfp")
|
||||||
|
) %>%
|
||||||
|
select(namelsad, year, population, housing_units) %>%
|
||||||
|
pivot_wider(
|
||||||
|
names_from = year,
|
||||||
|
values_from = c(housing_units, population),
|
||||||
|
names_glue = "{.value}_{year}"
|
||||||
|
)
|
||||||
|
|
||||||
|
housing_base <- paste0("housing_units_", base_year)
|
||||||
|
housing_current <- paste0("housing_units_", current_year)
|
||||||
|
pop_base <- paste0("population_", base_year)
|
||||||
|
pop_current <- paste0("population_", current_year)
|
||||||
|
|
||||||
|
county_data <- county_data %>%
|
||||||
|
select(
|
||||||
|
namelsad,
|
||||||
|
all_of(c(housing_base, housing_current, pop_base, pop_current))
|
||||||
)
|
)
|
||||||
|
|
||||||
output$great_miami_dt <- renderDT({
|
|
||||||
datatable(
|
datatable(
|
||||||
great_miami_data,
|
county_data,
|
||||||
rownames = F,
|
rownames = FALSE,
|
||||||
options = list(
|
options = list(
|
||||||
order = list(0, 'asc'),
|
order = list(0, 'asc'),
|
||||||
paging = F,
|
paging = FALSE,
|
||||||
searching = F,
|
searching = FALSE,
|
||||||
info = F,
|
info = FALSE,
|
||||||
lengthChange = F,
|
lengthChange = FALSE,
|
||||||
server = T
|
server = TRUE
|
||||||
),
|
),
|
||||||
colnames = c(
|
colnames = c(
|
||||||
"County",
|
"County",
|
||||||
"1926 HU",
|
paste0(base_year, " HU"),
|
||||||
"2024 HU",
|
paste0(current_year, " HU"),
|
||||||
"1926 POP",
|
paste0(base_year, " POP"),
|
||||||
"2024 POP"
|
paste0(current_year, " POP")
|
||||||
),
|
)
|
||||||
) %>%
|
) %>%
|
||||||
# Format housing columns with blue background
|
|
||||||
formatStyle(
|
formatStyle(
|
||||||
columns = c("housing_1926", "housing_2024"),
|
columns = c(housing_base, housing_current),
|
||||||
backgroundColor = "rgba(0, 0, 255, 0.2)"
|
|
||||||
) %>%
|
) %>%
|
||||||
# Format population columns with red background
|
|
||||||
formatStyle(
|
formatStyle(
|
||||||
columns = c("population_1926", "population_2024"),
|
columns = c(pop_base, pop_current),
|
||||||
backgroundColor = "rgba(255, 0, 0, 0.2)"
|
|
||||||
) %>%
|
) %>%
|
||||||
formatCurrency(
|
formatCurrency(
|
||||||
columns = c(
|
columns = c(housing_base, housing_current, pop_base, pop_current),
|
||||||
"housing_1926",
|
|
||||||
"housing_2024",
|
|
||||||
"population_1926",
|
|
||||||
"population_2024"
|
|
||||||
),
|
|
||||||
currency = "k",
|
|
||||||
digits = 0,
|
digits = 0,
|
||||||
before = F
|
before = FALSE
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
DTOutput("great_miami_dt")
|
DTOutput("county_growth_dt")
|
||||||
```
|
```
|
||||||
|
|
||||||
Normalization Calculator {data-navmenu="Compute"}
|
Normalization Calculator {data-navmenu="Compute"}
|
||||||
|
|||||||
Reference in New Issue
Block a user