Closed USMortality closed 9 months ago
I can't seem to access that CDC data but based on your code it seems like they are also using FIPS codes but they're just lacking some of them? I think you should be able to plot the data on the map but the counties that correspond to the missing FIPS codes will appear blank (whatever the default color of the map is). Is this what is happening or are you trying to do something other than coloring a map with the data?
Simple example:
The current, CDC dataset linked above, still uses Alaska's 02270 fips, instead of the reassigned 022158.
The fix is to run: df$fips[df$fips == "02270"] <- "02158"
on the cdc dataset, there's a handful more of these cases.
I was just wondering, if anyone has already mapped these out ;)
If not, just disregard this, and please close. thx :)
Unfortunately I'm not aware of anyone that's already done that mapping 🙁
Cool.
I managed to resolve most of it, except Alaska pre 2003, where I some counties were not just split/merged:
# Resolve mapping issues
df |>
split_row("02261", "02063", "02066") |>
split_row("02232", "02105", "02230") |>
split_row("02280", "02275", "02195")
df$fips[df$fips == "02270"] <- "02158"
df$fips[df$fips == "46113"] <- "46102"
split_row
is a custom function which simply splices a row into two...
I am using this great package to plot CDC Wonder county level data (e.g.: https://wonder.cdc.gov/controller/datarequest/D176)
County level data is available 1999-2023. Some counties have changed during that time, CDC does not seem to adhere strictly to the US Census mapping, either, but rather uses their own set of counties per year.
Do you have any suggestion how to handle these differences?
Here's an example, which compares the fips codes of the 2020 CDC Wonder query with the fips codes in this package:
Output:
The above fips codes, are missing in the cdc dataset...
I can probably create my own mapping table, just wondering if you had any solutions or if someone had already solved this issue. Thanks!