degauss-org / st_census_tract

link geocoded coordinates with date ranges to corresponding census tracts from the appropriate vintage
https://geomarker.io/st_census_tract
GNU General Public License v3.0
2 stars 0 forks source link

different vintages GISJOIN have different number of digits #10

Closed erikarasnick closed 2 years ago

erikarasnick commented 2 years ago

https://github.com/degauss-org/st_census_tract/blob/ad30e92c7140c2a2b21a6eb86f7da54c0d6c757b/get_tract_shapes_nhgis.R#L15

probably need to go back and join state fips, county fips, tract fips to make the entire fips string....

cole-brokamp commented 2 years ago

Is this because the original IDs were four digits and then the split ones were six digits? Would it make sense to "right pad" the early four digit tracts with to zeros to bring them up to six digits?

erikarasnick commented 2 years ago

I think that's part of it. I noticed this while putting finishing touches on the data for NGHS. For that data I did

glue::glue('{STATEA}{COUNTYA}{TRACTA}')

which results in, for example (in 2010 data), 39061000200 but the GISJOIN for that same tract is G3900610000200

Note the extra zeros.

erikarasnick commented 2 years ago

When I went to join st_census_tract output with NGHS data the tract ids aren't matching up because I used GISJOIN here and glued the string together for NGHS.

cole-brokamp commented 2 years ago

This script from old crew census degauss image might help: https://github.com/degauss-org/crew_census/blob/master/make_crew_geodata.R

erikarasnick commented 2 years ago

Yes, that is helpful. I will make sure it is done the same way here and for the NGHS data.