Download NHIS Public-Use Linked Mortality Files
Source:R/nhis_mortality.R
nhis_mortality_download.RdDownloads the fixed-width .dat mortality files from the CDC FTP server
for one or more NHIS survey years. Files are cached locally; re-downloading
is skipped unless refresh = TRUE.
Usage
nhis_mortality_download(
years = NULL,
refresh = FALSE,
quiet = !getOption("nhanesR.verbose", TRUE)
)Arguments
- years
Character or numeric vector of NHIS survey years (e.g.
"1997"or1997). Defaults to all years with a public-use LMF. Seenhis_lmf_years().- refresh
Logical. Re-download even if a cached file exists? Default
FALSE.- quiet
Logical. Suppress download messages? Default uses the
nhanesR.verboseoption.
Value
Invisibly, a named character vector of local file paths (one per
year). The primary side-effect is writing files to the cache directory
under mortality/dat/.
Details
NCHS distributes NHIS mortality linkage as one file per survey year (unlike NHANES's one file per 2-year cycle). The public-use LMF provides mortality follow-up through December 31, 2019 for NHIS 1986-2018.
See also
nhis_mortality_parse(), nhis_mortality_link(),
nhanes_mortality_download() for the NHANES equivalent.
Examples
# \donttest{
# Download specific years (downloading all 33 available years at once,
# via nhis_mortality_download() with no arguments, works the same way but
# is a much larger multi-file FTP batch -- prefer a specific year vector
# for routine use)
nhis_mortality_download(c("2015", "2016", "2017"))
# }