Man pages for mkiang/narcan
Helper functions for working with multiple cause of death data

add_county_fipsMake a new county_fips column that is consistent across years
add_hspanicr_columnAdd an NA hspanicr column if one doesn't exist
add_pop_countsGiven a dataframe with year, age, sex, and race, returns...
add_std_popGiven a dataframe with age, returns a standard population
appalachia_fipsDataframe of Appalachian counties with name and FIPS codes
calc_asrate_varCalculate age-specific rates and variance
calc_stdrate_varCalculate age-standardized rates and variance
categorize_age_5Create a categorical age column from a converted ager27...
categorize_age_5u1Create a categorical age column from a converted ager27...
categorize_hspanicrCreate a categorical Hispanic column from the hspanicr column
categorize_raceCreate a categorical race column from standardized race...
cdc_dictA dictionary of year:URL key:value pairs for the CDC FTP MCOD...
clean_icd9_dataA wrapper function to perform basic cleaning of ICD-9...
convert_ager27Converts the age27 variable in MCOD data to 5-year age groups
convert_ager27u1Converts the age27 variable in MCOD data to under-1, 1-4,...
dot-dct_to_fwf_dfDownloads the NBER Stata dct file and returns a dictionary...
dot-download_1979_pop_dataDownload 1979 Population Counts
dot-download_1980s_pop_dataDownload 1980s Population Counts
dot-download_1990s_pop_dataDownload 1990s Population Counts
dot-download_2000s_pop_dataDownload 2000s Population Counts
dot-download_2010s_pop_dataDownload 2010s Population Counts
dot-download_all_pop_dataDownload 1979-2015 Population Estimates
dot-download_mcod_fwfDownload the multiple cause of death data as an ASCII file...
dot-download_standard_popsDownload Standard Populations
dot-extract_yearHelper function that extracts year from a dataframe and...
dot-import_restricted_dataWrapper for importing restricted MCOD data
download_mcod_csvDownload the multiple cause of death data as a CSV file
download_mcod_dtaDownload the multiple cause of death data as a DTA file
download_natality_asciiDownload NCHS Natality (Live Births) Data from the CDC FTP...
flag_drug_deathsFlag drug deaths according to ISW7 rules
flag_heroin_presentCreates a new column called heroin_present if opioid death...
flag_maternal_deathsCreates a new column called maternal_death with 1 if maternal...
flag_maternal_deaths_lateCreates a new column called maternal_death with 1 if maternal...
flag_methadone_presentCreates a column 'methadone_present' if opioid death involved...
flag_nonheroinFlag all opioid deaths that were not from heroin
flag_nonopioid_drug_deathsFlag non-opioid drug deaths according to ISW7 rules
flag_od_intentFlag overdose deaths by their UCOD intent code
flag_opioid_contributedFlag non-opioid deaths that involved opioids
flag_opioid_deathsFlag opioid deaths according to ISW7 rules
flag_opioid_typesTake a processed MCOD dataframe and create indicators for...
flag_opium_presentCreates a column called 'opium_present' if opioid death...
flag_other_natural_presentCreates a column 'other_natural_present' if opioid death...
flag_other_op_presentCreates a column 'other_op_present' for deaths with other...
flag_other_synth_presentCreates a column called 'other_synth_present'
flag_suicide_deathsFlag suicide deaths (no accidental poisoning)
flag_suicide_fallFlag suicide by fall
flag_suicide_firearmFlag suicide by firearm
flag_suicide_otherFlag suicide by other (not poison, fall, firearm,...
flag_suicide_poisonFlag suicide by poison
flag_suicide_suffocationFlag suicide by suffocation
flag_suicide_typesFlag suicide five types: firearm, poisoning, fall,...
ihme_fipsMapping original FIPS codes to temporally stable FIPS codes...
label_od_intentLabel intent from underlying cause column for overdose drugs
label_suicide_typeCreate a new column with labels for suicide type
live_birthsDataframe of live births in the US from 2003-2016 by...
mcod_fwf_dictsDataframe of fixed width format information for MCOD files
mkdir_pWrapper to make a directory (and subdirectories) if necessary
narcannarcan R package for working with multiple cause of death...
pad_3char_codesPad ICD-9 codes that do not have a sub-code (i.e.,...
pop_estDataframe of annual population counts by age and race,...
prefix_e_to_ucodAdd the external cause flag (E) to appropriate ICD-9 UCOD...
prefix_to_recordAdd the prefix to appropriate ICD-9 record columns
remap_raceRemaps the race column to a single standard across 1979-2015
rename_ni_flagRename nature of injury columns for consistency
state_abbrev_to_fipsReplace state abbreviations with their corresponding FIPS...
std_popsDataframe of common standard populations from SEER website.
st_fips_mapMapping of state/territory name to abbreviation to FIPS code
subset_residentsSubset to US residents
summarize_binary_columnsSummarizes all flagged (e.g., 0/1) MCOD columns
trim_5char_recordTrim ICD-9 record columns that include the nature of injury...
trim_trailing_whitespaceTrim trailing whitespace on 3-char ICD-9 codes
unite_recordsUnite the 20 record columns from MCOD dataframe into a single...
zap_dta_dataClear Stata metadta from MCOD dta files
mkiang/narcan documentation built on Sept. 26, 2024, 7:18 a.m.