Changelog
Source:NEWS.md
nhanesR 0.1.4
CRAN resubmission fixes
- Expanded all unexpanded acronyms in
DESCRIPTION: “NCHS” → “National Center for Health Statistics (NCHS)” and “NDI” → “National Death Index (NDI)”. - Added NHANES methodology URL reference to
DESCRIPTION. - Replaced all
\dontrun{}with\donttest{}in examples; all examples require CDC network access so none were unwrapped. - Fixed
\dregex inNH_describedocumentation (unknown Rd macro on Windows); replaced with[0-9].
Bug fixes
- Removed “2017-2020” from the internal LMF registry: CDC has not published
NHANES_2017_2020_MORT_2019_PUBLIC.dat;has_lmf_publicset toFALSEfor that cycle. - Fixed
clipluralization crash innhanes_merge()when duplicate columns are found ({i}and{?s}quantity conflict resolved withcli::qty()). - Fixed several example bugs exposed by switching from
\dontrunto\donttest: missingcyclesargument innhanes_download_analyte()calls; list passed tonhanes_mortality_link()instead of a stacked data frame; undefinedlinked_dataobject innhanes_followup_summary()example.
nhanesR 0.1.3
Bug fixes
- Default cache directory changed from a platform-specific path under
~tofile.path(tempdir(), "nhanesR"). This prevents nhanesR from writing to the user’s home filespace without explicit consent, in compliance with CRAN Policy. To retain a persistent cache across sessions, setnhanesR.cache_dirin~/.Rprofile. -
nhanes_cache_dir("~/my_nhanes_cache")example wrapped in\dontrun{}to prevent directory creation duringR CMD CHECK.
nhanesR 0.1.2
Bug fixes
- Fixed broken CDC mortality linkage URL in three vignettes (CDC reorganised their site; updated to current NCHS Data Linkage landing page).
- Removed non-standard sentence from
DESCRIPTION. - Added
inst/WORDLISTto suppress spell-check NOTEs for domain abbreviations (NHANES, NCHS, LMF, NDI) and “codebook”.
nhanesR 0.1.1
Breaking changes
-
nhanes_harmonize(): theprefer_mgdlargument has been replaced byunits = c("conventional", "SI", "both"). The default ("conventional") preserves prior behaviour; setunits = "SI"to retain SI columns and drop conventional duplicates instead.
nhanesR 0.1.0
Initial release.
New functions
nhanes_cycles()— list all continuous NHANES cycles (1999–present) and optionally NHANES III (1988–1994), with cycle labels, begin/end years, and file-name suffixes.nhanes_manifest()— query the CDC data catalog for available files within a given cycle and component.nhanes_download()— download one or more NHANES XPT files from CDC, parse them into R data frames, and cache them locally. Falls back toforeign::read.xport()whenhaven::read_xpt()cannot parse older files.nhanes_stack()— row-bind per-cycle data frames into a single data frame, filling columns absent in some cycles withNA.nhanes_merge()— join NHANES components by SEQN (and optionally cycle), with survey-design-aware defaults.nhanes_mortality_link()— download the NCHS Public-Use Linked Mortality Files (LMF) for the relevant cycles and left-join them onto an analytic dataset by SEQN. Mortality follow-up runs through December 31, 2019.nhanes_survival_prep()— prepare a survival analysis dataset from a mortality-linked data frame: removes ineligible participants (ELIGSTAT != 1), createstimeandeventcolumns, optionally createsevent_causefor cause-specific mortality, and warns about asymmetric follow-up across cycles.nhanes_followup_summary()— summarize follow-up time and event rates by cycle.nhanes_ucod_labels()— return the 11-category ICD-10 underlying cause-of- death recode used in the public-use LMF.nhanes_search_variables()— search the CDC NHANES variable catalog for variables whose name or description matches a keyword. Results are cached locally. Thesummarizeargument (defaultTRUE) collapses one-row-per-cycle output into one row per unique variable name, with comma-separated file names, cycles, and ann_cyclescount.nhanes_variable_map()— wrapsnhanes_search_variables()to return a single-row-per-cycle lookup table (cycle,variable_name,file_name) for a given analyte. Automatically drops comment-code variables, prefers non-SI variables when both exist in a cycle, and accepts akeep_varsargument to disambiguate serum from urine forms of the same analyte (e.g. serum creatinine vs. urinary creatinine).nhanes_cache_dir()— view or change the local cache directory.
Bug fixes and infrastructure
Fixed CDC data file URLs: CDC reorganized all NHANES file paths from
/Nchs/Nhanes/{cycle}/to/Nchs/Data/Nhanes/Public/{begin_year}/DataFiles/. All download functions updated accordingly.Added Content-Type check in the HTTP download helper: CDC returns HTTP 200 with an HTML error page when a file has moved;
nhanesRnow detects this and aborts with an informative message rather than saving a corrupt file.Added
foreign::read.xport()fallback for XPT files thathaven::read_xpt()cannot parse (affects some files from NHANES cycles prior to 2003).MD5 hash sidecar files (
.md5) are written alongside every cached RDS to detect corruption and trigger re-download when needed.