Repository navigation
Add LTDB as a source for 2010 to 2000 tract crosswalks - #25
Open
wcurrangroome wants to merge 1 commit into
Open
wcurrangroome wants to merge 1 commit into
wcurrangroome wants to merge 1 commit into
Conversation
The Longitudinal Tract Database (LTDB, Brown University) now serves tract 2010 -> tract 2000, which NHGIS does not publish. The planner adds LTDB as the least preferred source for year-to-year steps, so later years chain automatically (e.g., tract 2020 -> 2000 runs NHGIS 2020 -> 2010, then LTDB 2010 -> 2000). - get_ltdb_crosswalk() downloads the LTDB file (no registration needed), reads it with haven, renames its columns to the package's standard columns, checks that each tract's allocation factors sum to 1, and caches the result. - LTDB has one weight, which combines land area and block population. Requests for any other weight stop with an error before downloading. - Users are told how to cite LTDB in the same places and the same way as for NHGIS: a message each time a crosswalk is returned, the crosswalk_metadata fields, and the README. - Adds haven (and its dependency forcats) to DESCRIPTION and renv.lock. Closes #21 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21. Stacked on the Geocorr 2000 PR (#22's branch); review #23 and that one first.
What this changes
get_ltdb_crosswalk():haven;crosswalk_metadatafields;havenand its dependencyforcatstoDESCRIPTIONandrenv.lock.Decisions
Known limitation
Geocorr 2000's population-weighted output leaves out tracts that had no population in 2000. LTDB includes them. In the 2010 tract → 2000 PUMA chain, 123 of LTDB's 65,274 tract IDs for 2000 are missing from Geocorr 2000's list. As a result, 144 of 72,531 tracts from 2010 lose some or all of their allocation at step 2 (161 rows, with allocation factors summing to 34.9). Only chains that use LTDB and then Geocorr 2000 are affected.
Testing
test-get_ltdb_crosswalk.R: 14 tests, 0 failed, 2 skipped. Skipped: the slow tests withoutCROSSWALK_RUN_SLOW_TESTS, and the 2020 → 2000 chain, which needsIPUMS_API_KEY. The agent ran the real-download test with slow tests on and it passed.🤖 Generated with Claude Code