Replication Materials for Brill and Ganz (2018)
Index: The zip file contains three folders:
The “R” folder contains all of the R code required to replicate all figures in the paper. R-3.3.3 was used to produce the paper; however, any recent version of R should reproduce the output faithfully.
The “data” folder stores the raw data used to generate the model. Information on data sources is available in the Technical Appendix of the paper.
The “out” folder is a repository for the output for the tables in the text. Once you run the Rmd file, new spreadsheets will be created that output the state and county results.
The “opioid_map” folder contains code for creating an interactive shiny map displaying per-capita opioid costs.
The following packages must be installed on your machine prior to running the code: knitr, mosaic, dplyr, readr, readxl, tidyr, stringr, choroplethr, choroplethrMaps, sas7bdat, tidycensus, lme4, glmmTMB, RColorBrewer.
Open and knit “opioid_distributional_analysis.Rmd”. If you knit to word, then the maps will be easily extractable from the resulting output, which will be saved in the “R” folder. In addition, the data used to create the tables in the paper are outputted to the “out” folder.