Skip to content

Fix 2010 ZCTA geometries for get_decennial() - #651

Open
NikKrieger wants to merge 2 commits into
walkerke:masterfrom
NikKrieger:fix-decennial-2010-ZCTA-geometry
Open

Fix 2010 ZCTA geometries for get_decennial()#651
NikKrieger wants to merge 2 commits into
walkerke:masterfrom
NikKrieger:fix-decennial-2010-ZCTA-geometry

Conversation

@NikKrieger

Copy link
Copy Markdown

The geometry column was empty for get_decennial(geography = "ZCTA", year = 2010, geometry = TRUE).

Despite the fact that tidycensus stripped the state prefix from ZCTA GEOIDs, tigris::zctas(year = 2010) includes the prefix as well. As a result, the right_join() was not successfully joining the tidycensus numbers with the geometries.

This PR adds code to strip the state prefix from the tigris output. It also adds tests.

Additionally, I changed unique() to any() in the if statements, because theoretically unique() could yield a vector of more than one element and break the if statement, causing a confusing error message difficult to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant