Project Part 1

Substances risk factor vs direct deaths.

Author

Affiliation

Nicholas Dean

 

Published

May 10, 2022

DOI

  1. I downloaded Death from Tobacco, alcohol and drugs from Our world in data. I chose this data because many younger generations don’t understand the importance of tobacco.

  2. This is the link to the data.

  3. The following code chunk loads the package I will use to read in and prepare the data for analysis.

library(tidyverse)
  1. Read the data in
substances_risk_factor_vs_direct_deaths <- 
read_csv(here::here("_posts/2022-05-10-project-part-1/substances-risk-factor-vs-direct-deaths.csv"))
  1. Use glimpse to see the names and types of the columns
glimpse(substances_risk_factor_vs_direct_deaths)
Rows: 6,840
Columns: 8
$ Entity                                                                                <chr> …
$ Code                                                                                  <chr> …
$ Year                                                                                  <dbl> …
$ `Deaths - Drug use disorders - Sex: Both - Age: All Ages (Number)`                    <dbl> …
$ `Deaths - Alcohol use disorders - Sex: Both - Age: All Ages (Number)`                 <dbl> …
$ `Deaths - Cause: All causes - Risk: Tobacco - Sex: Both - Age: All Ages (Number)`     <dbl> …
$ `Deaths - Cause: All causes - Risk: Drug use - Sex: Both - Age: All Ages (Number)`    <dbl> …
$ `Deaths - Cause: All causes - Risk: Alcohol use - Sex: Both - Age: All Ages (Number)` <dbl> …
#view(substances_risk_factor_vs_direct_deaths)
  1. Use output from glimpse (and view) to prepare the data for analysis
direct_deaths  <-
  
  substances_risk_factor_vs_direct_deaths %>% 
  filter(Year == 2019, Entity == "World") %>% 
  rename(drug_use_disorders = 4,
         Alchohol_use_disorders = 5,
         Cause_Tobacco = 6,
         Cause_Drug_Use = 7,
         Cause_Alchohol_Use = 8)  %>% 
  select(4:8) 
  
direct_deaths
# A tibble: 1 × 5
  drug_use_disorders Alchohol_use_disord… Cause_Tobacco Cause_Drug_Use
               <dbl>                <dbl>         <dbl>          <dbl>
1             128083               168015       8708898         494492
# … with 1 more variable: Cause_Alchohol_Use <dbl>

The graph matches the information as only 5 rows are depicted.

Add a picture.

Deaths from drug use

Project Completed with Nico Kellenberger.

write_csv(direct_deaths, file = "direct_deaths.csv")