Project Part 1

Preparing the Air Pollution data for plotting.

  1. I downloaded Air Pollution data from Our World in data. I chose this data because I love any topic that has to do with global warming and air pollution is part of that.

  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.

  1. Read the data in
number_of_deaths_by_risk_factor <- 
  read_csv(here::here("_posts/2022-05-07-project-part-1/number-of-deaths-by-risk-factor.csv"))
  1. Use glimpse to see the names and types of the columns.
glimpse(number_of_deaths_by_risk_factor)
Rows: 6,840
Columns: 31
$ Entity                                                                                                             <chr> …
$ Code                                                                                                               <chr> …
$ Year                                                                                                               <dbl> …
$ `Deaths - Cause: All causes - Risk: Outdoor air pollution - OWID - Sex: Both - Age: All Ages (Number)`             <dbl> …
$ `Deaths - Cause: All causes - Risk: High systolic blood pressure - Sex: Both - Age: All Ages (Number)`             <dbl> …
$ `Deaths - Cause: All causes - Risk: Diet high in sodium - Sex: Both - Age: All Ages (Number)`                      <dbl> …
$ `Deaths - Cause: All causes - Risk: Diet low in whole grains - Sex: Both - Age: All Ages (Number)`                 <dbl> …
$ `Deaths - Cause: All causes - Risk: Alcohol use - Sex: Both - Age: All Ages (Number)`                              <dbl> …
$ `Deaths - Cause: All causes - Risk: Diet low in fruits - Sex: Both - Age: All Ages (Number)`                       <dbl> …
$ `Deaths - Cause: All causes - Risk: Unsafe water source - Sex: Both - Age: All Ages (Number)`                      <dbl> …
$ `Deaths - Cause: All causes - Risk: Secondhand smoke - Sex: Both - Age: All Ages (Number)`                         <dbl> …
$ `Deaths - Cause: All causes - Risk: Low birth weight - Sex: Both - Age: All Ages (Number)`                         <dbl> …
$ `Deaths - Cause: All causes - Risk: Child wasting - Sex: Both - Age: All Ages (Number)`                            <dbl> …
$ `Deaths - Cause: All causes - Risk: Unsafe sex - Sex: Both - Age: All Ages (Number)`                               <dbl> …
$ `Deaths - Cause: All causes - Risk: Diet low in nuts and seeds - Sex: Both - Age: All Ages (Number)`               <dbl> …
$ `Deaths - Cause: All causes - Risk: Household air pollution from solid fuels - Sex: Both - Age: All Ages (Number)` <dbl> …
$ `Deaths - Cause: All causes - Risk: Diet low in vegetables - Sex: Both - Age: All Ages (Number)`                   <dbl> …
$ `Deaths - Cause: All causes - Risk: Low physical activity - Sex: Both - Age: All Ages (Number)`                    <dbl> …
$ `Deaths - Cause: All causes - Risk: Smoking - Sex: Both - Age: All Ages (Number)`                                  <dbl> …
$ `Deaths - Cause: All causes - Risk: High fasting plasma glucose - Sex: Both - Age: All Ages (Number)`              <dbl> …
$ `Deaths - Cause: All causes - Risk: Air pollution - Sex: Both - Age: All Ages (Number)`                            <dbl> …
$ `Deaths - Cause: All causes - Risk: High body-mass index - Sex: Both - Age: All Ages (Number)`                     <dbl> …
$ `Deaths - Cause: All causes - Risk: Unsafe sanitation - Sex: Both - Age: All Ages (Number)`                        <dbl> …
$ `Deaths - Cause: All causes - Risk: No access to handwashing facility - 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: Low bone mineral density - Sex: Both - Age: All Ages (Number)`                 <dbl> …
$ `Deaths - Cause: All causes - Risk: Vitamin A deficiency - Sex: Both - Age: All Ages (Number)`                     <dbl> …
$ `Deaths - Cause: All causes - Risk: Child stunting - Sex: Both - Age: All Ages (Number)`                           <dbl> …
$ `Deaths - Cause: All causes - Risk: Discontinued breastfeeding - Sex: Both - Age: All Ages (Number)`               <dbl> …
$ `Deaths - Cause: All causes - Risk: Non-exclusive breastfeeding - Sex: Both - Age: All Ages (Number)`              <dbl> …
$ `Deaths - Cause: All causes - Risk: Iron deficiency - Sex: Both - Age: All Ages (Number)`                          <dbl> …
# View(number_of_deaths_by_risk_factor)
  1. Select columns Entity, and Deaths - Cause: All causes - Risk: Outdoor air pollution - OWID - Sex: Both - Age: All Ages (Number).
number_of_deaths_by_risk_factor %>%
  select(Year, `Entity`, `Deaths - Cause: All causes - Risk: Outdoor air pollution - OWID - Sex: Both - Age: All Ages (Number)`)
# A tibble: 6,840 × 3
    Year Entity      `Deaths - Cause: All causes - Risk: Outdoor air…`
   <dbl> <chr>                                                   <dbl>
 1  1990 Afghanistan                                              3169
 2  1991 Afghanistan                                              3222
 3  1992 Afghanistan                                              3395
 4  1993 Afghanistan                                              3623
 5  1994 Afghanistan                                              3788
 6  1995 Afghanistan                                              3869
 7  1996 Afghanistan                                              3943
 8  1997 Afghanistan                                              4024
 9  1998 Afghanistan                                              4040
10  1999 Afghanistan                                              4042
# … with 6,830 more rows
  1. Rename entity to region with select
number_of_deaths_by_risk_factor %>%
  select( region =Entity)
# A tibble: 6,840 × 1
   region     
   <chr>      
 1 Afghanistan
 2 Afghanistan
 3 Afghanistan
 4 Afghanistan
 5 Afghanistan
 6 Afghanistan
 7 Afghanistan
 8 Afghanistan
 9 Afghanistan
10 Afghanistan
# … with 6,830 more rows
  1. Add a picture.

project 1 chart Write the data to file in the project directory

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