All functions

add_hspanicr_column()

Add an NA hspanicr column if one doesn't exist

add_pop_counts()

Given a dataframe with year, age, sex, and race, returns population estimate

add_std_pop()

Given a dataframe with age, returns a standard population

appalachia_fips

Dataframe of Appalachian counties with name and FIPS codes

calc_asrate_var()

Calculate age-specific rates and variance

calc_stdrate_var()

Calculate age-standardized rates and variance

categorize_age_5()

Create a categorical age column from a converted ager27 column

categorize_hspanicr()

Create a categorical Hispanic column from the hspanicr column

categorize_race()

Create a categorical race column from standardized race column

cdc_dict

A dictionary of year:URL key:value pairs for the CDC FTP MCOD files

clean_icd9_data()

A wrapper function to perform basic cleaning of ICD-9 dataframes

convert_ager27()

Converts the age27 variable in MCOD data to 5-year age groups

.dct_to_fwf_df()

Downloads the NBER Stata dct file and returns a dictionary with column data

.download_1979_pop_data()

Download 1979 Population Counts

.download_1980s_pop_data()

Download 1980s Population Counts

.download_1990s_pop_data()

Download 1990s Population Counts

.download_2000s_pop_data()

Download 2000s Population Counts

.download_2010s_pop_data()

Download 2010s Population Counts

.download_all_pop_data()

Download 1979-2015 Population Estimates

.download_mcod_fwf()

Download the multiple cause of death data as an ASCII file from the CDC

.download_standard_pops()

Download Standard Populations

.extract_year()

Helper function that extracts year from a dataframe and raises error if more than one.

.import_restricted_data()

Wrapper for importing restricted MCOD data

download_mcod_csv()

Download the multiple cause of death data as a CSV file

download_mcod_dta()

Download the multiple cause of death data as a DTA file

download_natality_ascii()

Download NCHS Natality (Live Births) Data from the CDC FTP (ASCII)

flag_drug_deaths()

Flag drug deaths according to ISW7 rules

flag_heroin_present()

Creates a new column called heroin_present if opioid death involved heroin

flag_maternal_deaths()

Creates a new column called maternal_death with 1 if maternal death

flag_maternal_deaths_late()

Creates a new column called maternal_death with 1 if maternal death (late)

flag_methadone_present()

Creates a column `methadone_present` if opioid death involved methadone

flag_nonheroin()

Flag all opioid deaths that were not from heroin

flag_nonopioid_drug_deaths()

Flag non-opioid drug deaths according to ISW7 rules

flag_od_intent()

Flag overdose deaths by their UCOD intent code

flag_opioid_contributed()

Flag non-opioid deaths that involved opioids

flag_opioid_deaths()

Flag opioid deaths according to ISW7 rules

flag_opioid_types()

Take a processed MCOD dataframe and create indicators for opioid types

flag_opium_present()

Creates a column called `opium_present` if opioid death involved opium

flag_other_natural_present()

Creates a column `other_natural_present` if opioid death involved opium

flag_other_op_present()

Creates a column `other_op_present` for deaths with other unspecified opioid

flag_other_synth_present()

Creates a column called `other_synth_present`

flag_suicide_deaths()

Flag suicide deaths (no accidental poisoning)

flag_suicide_fall()

Flag suicide by fall

flag_suicide_firearm()

Flag suicide by firearm

flag_suicide_other()

Flag suicide by other (not poison, fall, firearm, suffocation)

flag_suicide_poison()

Flag suicide by poison

flag_suicide_suffocation()

Flag suicide by suffocation

flag_suicide_types()

Flag suicide five types: firearm, poisoning, fall, suffocation, or other

ihme_fips

Mapping original FIPS codes to temporally stable FIPS codes from IHME

label_od_intent()

Label intent from underlying cause column for overdose drugs

label_suicide_type()

Create a new column with labels for suicide type

live_births

Dataframe of live births in the US from 2003-2016 by race/ethnicity and age.

mkdir_p()

Wrapper to make a directory (and subdirectories) if necessary

narcan

narcan R package for working with multiple cause of death data

pad_3char_codes()

Pad ICD-9 codes that do not have a sub-code (i.e., 3-character codes)

pop_est

Dataframe of annual population counts by age and race, 1979-2015

prefix_e_to_ucod()

Add the external cause flag (E) to appropriate ICD-9 UCOD codes

prefix_to_record()

Add the prefix to appropriate ICD-9 record columns

remap_race()

Remaps the race column to a single standard across 1979-2015

rename_ni_flag()

Rename nature of injury columns for consistency

st_fips_map

Mapping of state/territory name to abbreviation to FIPS code

state_abbrev_to_fips()

Replace state abbreviations with their corresponding FIPS code

std_pops

Dataframe of common standard populations from SEER website.

subset_residents()

Subset to US residents

summarize_binary_columns()

Summarizes all flagged (e.g., 0/1) MCOD columns

trim_5char_record()

Trim ICD-9 record columns that include the nature of injury flag

trim_trailing_whitespace()

Trim trailing whitespace on 3-char ICD-9 codes

unite_records()

Unite the 20 record columns from MCOD dataframe into a single column

zap_dta_data()

Clear Stata metadta from MCOD dta files