process_mort: Process mortality data for NHANES 2003-2004 and 2005-2006...

Description Usage Arguments Details Value References Examples

View source: R/process_accel.R

Description

This function creates a clean mortality dataset which can be combined with data from the NHANES 2003-2004/2005-2006 waves.

Usage

1
process_mort(waves = c("C", "D"), mort_release_yr = 2011, localpath = NULL)

Arguments

waves

Character vector indicating the waves . Defaults to a vector with "C" and "D", corresponding to the 2003-2004 and 2005-2006 waves.

mort_release_yr

Nuemric value indicating the year associated with the raw mortality data to be processed. The default, 2011, corresponds to the most recent raw mortality data included in the data package.

localpath

Character scalar describing the location where the raw data are stored. If NULL, the funciton will look in pacakge data directory for the requested raw mortality data. Defaults to NULL.

Details

As of writing, this function has only been tested on the 2011 release for the 2003-2004 and 2005-2006 NHANES mortality data.devtools::check(args = "–as-cran") The raw data comes in the form of a vector of strings, with each string associated with on participant. Assuming mortality releases for other waves use the same format, this function. As future mortality data are released, we will update the package with both the processed and raw mortality data for the NHANES 2003-2006 waves. If necessary, we will modify the code to be able to process all releases of the mortality data for 2011 and beyond. The documentation here will be updated as we confirm future mortality data releases are processed correctly using this function.

Value

This function will return a list with number of elements less than or equal to the number of waves of data specified by the "waves" argument. The exact number of elements returned will depend on whether all files specified by the user are found in either: 1) the local directory indicated by the localpath argument; or available in the data package. Because the mortality data provided changes from year-to-year, the columns of each element will depend on the release year.

For the 2011 release year data, each element of the list returned is a data frame with columns:

For the 2015 release year data, only the first 8 columns described above are provided.

References

National Center for Health Statistics. Office of Analysis and Epidemiology, Public-use Linked Mortality File, 2015. Hyattsville, Maryland. (Available at the following address: http://www.cdc.gov/nchs/data_access/data_linkage/mortality.htm

Examples

1
2
3
4
5
6
7
8
9
library("rnhanesdata")

## process NHANES mortality data using the raw mortality data release from 2011 that comes
## with the package
mort_ls <- process_mort()

## verify that this yields identical results to the processed data included in the package
identical(mort_ls$Mortality_2011_C, Mortality_2011_C)
identical(mort_ls$Mortality_2011_D, Mortality_2011_D)

andrew-leroux/rnhanesdata documentation built on March 6, 2020, 11:35 p.m.