Closed USMortality closed 10 months ago
In 2019 the Valdez-Cordova Census Area in Alaska split into two separate areas (Chugach Census Area and Copper River Census Area) which is what you're seeing there as gray in the map.
The population dataset included in the package is from 2015 which is why it doesn't account for those. The map itself should be correct since the shape files were updated in 2020 but I can double-check to make sure.
Thanks for bringing this to my attention though, it's probably worth updating the included sample data 😅
Yes, so the library appears to handle the latest census counties then correctly, thx.
Here's the updated sample code, it seems that county_fips.csv
maybe should be updated as well.
df <- read_csv(system.file("extdata", "county_fips.csv", package = "usmap")) |>
select(fips)
df$pop <- 1000
# Manually add the two new AK counties
df2 <- df |>
add_row(tibble(
fips = "02063",
pop = 1000
)) |>
add_row(tibble(
fips = "02066",
pop = 1000
))
usmap::plot_usmap(
data = df2,
"counties",
values = "pop",
color = NA
) + scale_fill_viridis_c(
option = "D",
na.value = "#bbbbbb",
name = "population"
)
Good point, looks like they are missing from county_fips.csv
. I'll be sure to add it in for the next release.
After some investigation it appears I already added these counties to usmapdata
but the usmap
functions fips
and fips_info
are still referring to the older files stored in usmap
. I'm currently in the process of removing these and referencing the data in usmapdata
directly so there's a single source for the FIPS data.
usmapdata
is currently being released to CRAN. When it is uploaded I can update usmap
with the changes.
Describe the bug Using the built-in county list, and the provided sample population file, I can see that two Alaska counties are not mapped correctly.
Any idea?
To Reproduce
Same happens with:
countypop <- readxl::read_excel("https://raw.githubusercontent.com/pdil/usmap/master/data-raw/countypop.xlsx")