Fix cross-language inconsistencies; add print/fast parity#9
Open
Yicheng-Zhao1999 wants to merge 1 commit into
Open
Fix cross-language inconsistencies; add print/fast parity#9Yicheng-Zhao1999 wants to merge 1 commit into
Yicheng-Zhao1999 wants to merge 1 commit into
Conversation
- Variable names matched case-insensitively and normalized to the dataset's canonical casing, e.g. "rgdp" -> "rGDP" (KMueller-Lab#2) - Trim whitespace consistently with Python/Stata; blank tokens dropped and an empty/all-blank value becomes NULL ("no filter") instead of erroring (KMueller-Lab#4) - Validate an invalid version before honoring cite (KMueller-Lab#7) - Add print_option (APA citation) for parity with Python/Stata - Add fast (local dataset cache under R_user_dir) for parity with Python/Stata Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Cross-language consistency fixes + feature parity (R)
Aligns
R/gmd.Rwith the Python/Stata packages and adds two options those packagesalready have. Verified against live version
2026_03.Coverage (this package = R)
rawwith a non-boolean valueprint_optionfastWhat changed
variables = "rgdp"matches and is normalized to canonical casing (rGDP).country = " USA ",version = " 2026_03 ", whitespace-only / empty vectors nolonger error; blank tokens are dropped and an empty value becomes NULL ("no filter").
gmd(cite = "GMD", version = "2099_99")now errors on the invalid versioninstead of silently returning the citation.
print_option = "GMD"/"Stata"(case-insensitive) prints the APA citationand returns invisibly; text is byte-identical to the Python output.
fast = TRUEcaches the downloaded dataset undertools::R_user_dir("globalmacrodata", "cache"); the original.dtabytes are storedverbatim so a cached read is byte-identical to a fresh download.
Intentionally not added:
networkPython/Stata's
networkoverrides a connectivity heuristic: when their version fetchfails they assume "offline", load a local dataset, and refuse sources/raw/cite unless
network="yes"forces them. R has no such global verdict -- it attempts each realrequest independently and falls back / errors per resource. There is nothing for
networkto override, so it would be a no-op in R.Pending decision
gmd(vars=TRUE)/gmd(iso=TRUE)return adata.frame in R, while Python/Stata print and return None (and Python exposes
list_variables()/list_countries()for the data). Sox <- gmd(vars=TRUE)yieldsdata in R but None in Python. Left as-is pending a decision on whether to align.