Package: nhanesR 0.1.5

David Winsemius

nhanesR: Download, Parse, and Analyze NHANES Data with Mortality Linkage

Provides tools for downloading and organizing National Health and Nutrition Examination Survey (NHANES) public-use data files and the National Center for Health Statistics (NCHS) Public-Use Linked Mortality Files (LMF). Supports structured local caching, codebook access, survey-aware merging, and preparation of survival analysis datasets using NHANES-National Death Index (NDI) linked mortality data (follow-up through December 31, 2019). NHANES methodology is described at <https://wwwn.cdc.gov/nchs/nhanes/Default.aspx>.

Authors:David Winsemius [aut, cre]

nhanesR_0.1.5.tar.gz
nhanesR_0.1.5.tar.gz(r-4.7-any)nhanesR_0.1.5.tar.gz(r-4.6-any)
nhanesR_0.1.5.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
nhanesR/json (API)

# Install 'nhanesR' in R:
install.packages('nhanesR', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/dwinsemius/nhanesr/issues

Pkgdown/docs site:https://dwinsemius.github.io

On CRAN:

Conda:

3.94 score 35 scripts 22 exports 31 dependencies

Last updated from:561e7cc48c. Checks:4 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK142
source / vignettesOK199
linux-release-x86_64OK142
wasm-releaseOK128

Exports:NH_describeNH_labelnhanes_cache_dirnhanes_cyclesnhanes_downloadnhanes_download_analytenhanes_followup_summarynhanes_harmonizenhanes_lmf_cyclesnhanes_manifestnhanes_mergenhanes_mortality_downloadnhanes_mortality_linknhanes_mortality_parsenhanes_search_variablesnhanes_stacknhanes_survival_prepnhanes_ucod_labelsnhanes_variable_mapsvycph_fusesvycph_set_basehazweighted_basehaz

Dependencies:askpassbitbit64clicliprcpp11crayoncurlforcatsgluehavenhmshttr2lifecyclemagrittropensslpillarpkgconfigprettyunitsprogressR6readrrlangsystibbletidyselecttzdbutf8vctrsvroomwithr

Getting Started with nhanesR
What nhanesR does | Installation | Setup and options | Default cache location | Permanent configuration via .Rprofile | Checking and changing settings interactively | Function map | Stage 1 — Discovery | Stage 2 — Variable search | Stage 3 — Download | Stage 4 — Harmonize and stack | Stage 5 — Mortality linkage | Stage 6 — Survival analysis preparation | Cache management | Typical workflow | Further reading

Last update: 2026-07-17
Started: 2026-07-17

Navigating Variable Name Changes and Analyte Gaps in NHANES
The problem | The quality gap in published NHANES research | Two structural barriers to full-cycle, properly-weighted analyses | A pragmatic, hypothesis-first approach | The analytic panel | The CDC catalog gap for 1999–2002 BIOPRO data | Step 1: Discovering where an analyte lives | Example 1: A well-behaved analyte | Example 2: A variable with a prefix change | Example 3: An analyte missing from one cycle | Example 4: An analyte confined to a few cycles | Example 5: A questionnaire variable with a case change | Step 2: Downloading with automatic harmonisation | Downloading ALP across all available cycles | Downloading ALT across all available cycles | Downloading AST across its available cycles | Downloading the questionnaire variable with a case change | Example 6: Disambiguation by component — serum versus urine albumin | Step 3: Assembling the multi-analyte base | Step 4: Derived variables | What the manual approach looks like | Using nhanesR with AI coding assistants | Further reading | Summary of functions used | Session information

Last update: 2026-07-17
Started: 2026-07-17

NHANES Mortality Linkage: A Complete Workflow
Overview | Package options | Background: NHANES structure | 1. What cycles and files are available? | 2. Discover variables | 3. Download laboratory data | 4. Download questionnaire data | 5. Harmonize across cycles | 6. Recode questionnaire variables | 7. Stack demographics and merge all components | 8. Link mortality and prepare the survival dataset | 9. Survey-weighted Cox model | Choosing the correct survey weight | Pooling across cycles | Notes on data management | Cross-cycle variable harmonization | SEQN is a character identifier | NHANES questionnaire coding | Notes on the public-use LMF

Last update: 2026-07-17
Started: 2026-07-17

Survey-Weighted Survival Analysis: Fusing svycoxph and rms
Background and Motivation | Why not just use cph()? | Why not just use svycoxph()? | The fusion approach | Key references | Step 1: Examine object structures | Comparing weighted and unweighted estimates | Step 2: Identify Design slot dependencies | Step 3: Implement the fusion | Comparing anova.rms() output: survey-correct vs naive | Step 4: Survey-weighted baseline hazard | Step 5: Degrees of freedom correction | Conclusions and current limitations | What works | Empirical demonstration of design effects | When survey weighting is and is not necessary | Current limitations | The nhanesR package | A broader methodological agenda | Session information

Last update: 2026-07-17
Started: 2026-07-17

Urinary Albumin-to-Creatinine Ratio Across NHANES Cycles
Overview | Step 1 — Locate the variables | Step 2 — Download and stack | Step 3 — Calculate UACR | Step 4 — Method comparability and bridging | Known method changes | Bridging equations for serum creatinine | Step 5 — Survival analysis with survey weights | Notes and caveats | See also

Last update: 2026-07-17
Started: 2026-07-17