library("knitr")
library("tidyverse")
# install the package
# install.packages("fivethirtyeight")
# loading package
library("fivethirtyeight")
# data set
df.data = drug_use
Drugs and alcohol have deleterious effects on the brain and body. The NIH documented that approximately 80,000 people die annually due to drug and alcohol related substance abuse.
In 2012, over 55,000 Americans reported on their drug use in the past year (http://www.icpsr.umich.edu/icpsrweb/content/SAMHDA/index.html).
Figure 1 shows that alcohol was the most commonly used substance across all ages (spanning from age 12 to age 65 and older). Nearly 4% of 12-year-old children reported consuming alcohol, with a steady increase across the lifespan with over 75% of the population consuming alcohol between the ages of 21-49 years old. There was a small decline in the percentage of alcohol users around age 30, however nearly half of the population reported drinking alcohol. On average, participants drank 33 days a year (range = 3-52).
The second most commonly used substance was marijuana. 12-year-old children and people over the age of 65 reported using this substance the least (approximately 1%), and adolescents aged 16-25 years old reported using marijuana the most (over 23%). Participants used marijuana approximately 43 days a year on average (range = 4-72).
It is imperative to consider both the addictiveness of a particular drug as well as the prevalence when trying to effectively decrease substance abuse and create effective treatments in the population.
# Tidying data
drug_use_tidy= drug_use %>%
select(-n) %>%
gather(
key = "drug",
value = "frequency",
-age)
# Percentage of Americans that used these drugs in the following year
ggplot(data = drug_use_tidy %>% filter(grepl("_use", drug)), mapping = aes(x = age, y = frequency, color = drug)) +
stat_summary(fun.data = mean_cl_boot,
geom = "point",
alpha = 0.75) +
geom_line(aes(group=drug)) +
ggtitle("Reported Drug Use in 2012") +
theme_classic()+
xlab("Age Group") +
ylab("Percentage") +
labs(tag = "Figure 1") +
ylim(min(0), max(100)) +
scale_color_hue(labels= c("Alcohol", "Cocaine", "Crack", "Hallucinogens", "Heroin", "Inhalants", "Marijuana", "Methamphetamine", "Oxycontin", "Pain Releiver", "Sedative", "Stimulant", "Tranquilzer")) +
theme(plot.title=element_text(hjust=.5)) +
geom_hline(yintercept = seq(from = 0, to = 100, by = 25),
linetype = 2,
alpha = 0.2) +
theme(text = element_text(size = 9))
Alcohol is the most commonly used substance across the lifespan (increasing from age 12-23 with small declines from age 24-65+) and marijuana is the second most commonly used substance (increasing from age 12-21 with small declines from age 22-65+).
I plotted the data using a line graph because it visualizes the differences across drug types and age groups in a cohesive and precise fashion. The line graph also allows the reader to assess differing growth curves across each drug and corresponding age group.
# Descriptive Statistics
# Number of people that completed the survey
sum(drug_use$n)
## [1] 55268
# Alchohol statistics
mean(drug_use$alcohol_freq)
## [1] 33.35294
range(drug_use$alcohol_freq)
## [1] 3 52
# Marijuana statistics
mean(drug_use$marijuana_freq)
## [1] 42.94118
range(drug_use$marijuana_freq)
## [1] 4 72
Information about this R session including which version of R was used, and what packages were loaded.
sessionInfo()
## R version 3.5.1 (2018-07-02)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: OS X El Capitan 10.11.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] bindrcpp_0.2.2 fivethirtyeight_0.4.0 forcats_0.3.0
## [4] stringr_1.3.1 dplyr_0.7.6 purrr_0.2.5
## [7] readr_1.1.1 tidyr_0.8.1 tibble_1.4.2
## [10] ggplot2_3.0.0 tidyverse_1.2.1 knitr_1.21
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.19 lubridate_1.7.4 lattice_0.20-35
## [4] assertthat_0.2.0 rprojroot_1.3-2 digest_0.6.18
## [7] R6_2.2.2 cellranger_1.1.0 plyr_1.8.4
## [10] backports_1.1.2 acepack_1.4.1 evaluate_0.11
## [13] httr_1.3.1 pillar_1.3.0 rlang_0.2.2
## [16] lazyeval_0.2.1 readxl_1.1.0 rstudioapi_0.8
## [19] data.table_1.11.8 rpart_4.1-13 Matrix_1.2-14
## [22] checkmate_1.9.0 rmarkdown_1.10 labeling_0.3
## [25] splines_3.5.1 foreign_0.8-70 htmlwidgets_1.3
## [28] munsell_0.5.0 broom_0.5.0 compiler_3.5.1
## [31] modelr_0.1.2 xfun_0.3 pkgconfig_2.0.2
## [34] base64enc_0.1-3 htmltools_0.3.6 nnet_7.3-12
## [37] tidyselect_0.2.4 gridExtra_2.3 htmlTable_1.13.1
## [40] Hmisc_4.1-1 crayon_1.3.4 withr_2.1.2
## [43] grid_3.5.1 nlme_3.1-137 jsonlite_1.5
## [46] gtable_0.2.0 magrittr_1.5 scales_1.0.0
## [49] cli_1.0.1 stringi_1.2.4 latticeExtra_0.6-28
## [52] xml2_1.2.0 Formula_1.2-3 RColorBrewer_1.1-2
## [55] tools_3.5.1 glue_1.3.0 hms_0.4.2
## [58] survival_2.42-3 yaml_2.2.0 colorspace_1.3-2
## [61] cluster_2.0.7-1 rvest_0.3.2 bindr_0.1.1
## [64] haven_1.1.2