small edits

This commit is contained in:
Ben Varick 2024-04-06 21:45:52 -05:00
parent 6fdfaf6b4e
commit 96c4d1f6c4
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo
2 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -134,7 +134,7 @@ county_populations <- get_estimates(geography = "county", year = 2022, product =
county_populations <- st_transform(county_populations, crs = 4326) county_populations <- st_transform(county_populations, crs = 4326)
County_Crash_geom <- left_join(county_populations, County_Crash_Data, join_by("County")) County_Crash_geom <- left_join(county_populations, County_Crash_Data, join_by("County"))
County_Crash_geom <- County_Crash_geom %>% County_Crash_geom <- County_Crash_geom %>%
mutate(CrashesPerPopulation = MeanCrashes/value*100000) mutate(CrashesPerPopulation = MeanCrashes/(value/100000))
County_Crash_geom$CrashesPerPopulation[is.na(County_Crash_geom$CrashesPerPopulation)] <- 0 County_Crash_geom$CrashesPerPopulation[is.na(County_Crash_geom$CrashesPerPopulation)] <- 0
county_pal <- colorNumeric(palette = "YlOrRd", domain = c(min(County_Crash_geom$CrashesPerPopulation, na.rm = TRUE), max(County_Crash_geom$CrashesPerPopulation, na.rm = TRUE))) county_pal <- colorNumeric(palette = "YlOrRd", domain = c(min(County_Crash_geom$CrashesPerPopulation, na.rm = TRUE), max(County_Crash_geom$CrashesPerPopulation, na.rm = TRUE)))
@ -217,7 +217,7 @@ wisconsin_crash_map <-
fillColor=county_pal(County_Crash_geom$CrashesPerPopulation), fillColor=county_pal(County_Crash_geom$CrashesPerPopulation),
fillOpacity = 0.6, fillOpacity = 0.6,
label = lapply(paste0("<b>", str_to_title(County_Crash_geom$County), " County</b></br>", label = lapply(paste0("<b>", str_to_title(County_Crash_geom$County), " County</b></br>",
"population: ", County_Crash_geom$value, "<br>", "population: ", format(County_Crash_geom$value, nsmall=0, big.mark=","), "<br>",
"average crashes per year: ", round(County_Crash_geom$MeanCrashes,0), "</br>", "average crashes per year: ", round(County_Crash_geom$MeanCrashes,0), "</br>",
"average crashes/year per 100k residents: ", round(County_Crash_geom$CrashesPerPopulation,0)), htmltools::HTML), "average crashes/year per 100k residents: ", round(County_Crash_geom$CrashesPerPopulation,0)), htmltools::HTML),
group = "Counties") %>% group = "Counties") %>%