Code for Lim et al. (2024) Temporal and spatial trends of fentanyl co-occurrence in the illicit drug supply in the United States: a serial cross-sectional analysis. The Lancet Regional Health – Americas, Volume 39, 100898. 10.1016/j.lana.2024.100898
For any questions please contact Tse Yang Lim
The main file used in this analysis is the R markdown notebook fentanyl_supply_analysis_v2.Rmd, which calls data cleaning, analysis, and graphing scripts as needed. The notebook specifies the following settings:
dat_folderis the file path to the local directory wherecsvraw data files are. Note that we are unable to share the raw, record-level NFLIS data files used in this analysis; these may be obtained by request to the DEA or FDA.dat_yearsspecifies the years to be included in the analysis.update_raw_datais the switch for raw data intake - reading of separate raw data files to merge them into a single combined data file (also not shared).update_clean_datais the switch for data processing - applying sample restrictions and defining substance categories as explained in the article.update_analysisis the switch for rerunning the analysis - calculating and identifying trends in sample-level fentanyl co-occurrence with various substances.druglistspecifies the substance categories to include in the analysis.fig_extspecifies the filetype (by file extension) to use for saving figures.
The root directory also contains the notebook's corresponding html file and an RStudio RProj file for convenience.
Contains R scripts for data cleaning, analysis, and graphing, called by the main fentanyl_supply_analysis_v2.Rmd notebook
Contains information assembled from publicly available data:
- Most commonly reported substances in NFLIS annual reports from 2013-2022, and our corresponding substance category definitions, corresponding to Table S3
- State names and abbreviations
Contains high-resolution versions of all figures in the article and its supplement, generated by the graphing code in auxiliary
Contains csv tabular versions of data presented in main article and supplementary figures, Mann-Kendall trend test results corresponding to Table S1 & S2, as well as intermediate data files produced in the course of data cleaning & analysis (in subdirectory processed)