Life Expectancy Ji

What Makes Us Live Longer Than Before?

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(openintro)
Loading required package: airports
Loading required package: cherryblossom
Loading required package: usdata
library(tidymodels)
── Attaching packages ────────────────────────────────────── tidymodels 1.1.1 ──
✔ broom        1.0.5     ✔ rsample      1.2.0
✔ dials        1.2.0     ✔ tune         1.1.2
✔ infer        1.0.6     ✔ workflows    1.1.3
✔ modeldata    1.3.0     ✔ workflowsets 1.0.1
✔ parsnip      1.1.1     ✔ yardstick    1.3.0
✔ recipes      1.0.9     
── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ──
✖ scales::discard() masks purrr::discard()
✖ dplyr::filter()   masks stats::filter()
✖ recipes::fixed()  masks stringr::fixed()
✖ dplyr::lag()      masks stats::lag()
✖ yardstick::spec() masks readr::spec()
✖ recipes::step()   masks stats::step()
• Search for functions across packages at https://www.tidymodels.org/find/
setwd("~/Documents/Math 217/Final Project")
worldlife_exp <- read_csv("life_expectancy.csv")
Rows: 3306 Columns: 16
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (4): Country Name, Country Code, Region, IncomeGroup
dbl (12): Year, Life Expectancy World Bank, Prevelance of Undernourishment, ...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
str(worldlife_exp)
spc_tbl_ [3,306 × 16] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ Country Name                  : chr [1:3306] "Afghanistan" "Angola" "Albania" "Andorra" ...
 $ Country Code                  : chr [1:3306] "AFG" "AGO" "ALB" "AND" ...
 $ Region                        : chr [1:3306] "South Asia" "Sub-Saharan Africa" "Europe & Central Asia" "Europe & Central Asia" ...
 $ IncomeGroup                   : chr [1:3306] "Low income" "Lower middle income" "Upper middle income" "High income" ...
 $ Year                          : num [1:3306] 2001 2001 2001 2001 2001 ...
 $ Life Expectancy World Bank    : num [1:3306] 56.3 47.1 74.3 NA 74.5 ...
 $ Prevelance of Undernourishment: num [1:3306] 47.8 67.5 4.9 NA 2.8 3 26.1 NA NA 2.5 ...
 $ CO2                           : num [1:3306] 730 15960 3230 520 97200 ...
 $ Health Expenditure %          : num [1:3306] NA 4.48 7.14 5.87 2.48 ...
 $ Education Expenditure %       : num [1:3306] NA NA 3.46 NA NA ...
 $ Unemployment                  : num [1:3306] 10.81 4 18.58 NA 2.49 ...
 $ Corruption                    : num [1:3306] NA NA NA NA NA NA NA NA NA NA ...
 $ Sanitation                    : num [1:3306] NA NA 40.5 21.8 NA ...
 $ Injuries                      : num [1:3306] 2179727 1392081 117082 1698 144678 ...
 $ Communicable                  : num [1:3306] 9689194 11190211 140895 696 65272 ...
 $ NonCommunicable               : num [1:3306] 5795426 2663516 532325 13637 481741 ...
 - attr(*, "spec")=
  .. cols(
  ..   `Country Name` = col_character(),
  ..   `Country Code` = col_character(),
  ..   Region = col_character(),
  ..   IncomeGroup = col_character(),
  ..   Year = col_double(),
  ..   `Life Expectancy World Bank` = col_double(),
  ..   `Prevelance of Undernourishment` = col_double(),
  ..   CO2 = col_double(),
  ..   `Health Expenditure %` = col_double(),
  ..   `Education Expenditure %` = col_double(),
  ..   Unemployment = col_double(),
  ..   Corruption = col_double(),
  ..   Sanitation = col_double(),
  ..   Injuries = col_double(),
  ..   Communicable = col_double(),
  ..   NonCommunicable = col_double()
  .. )
 - attr(*, "problems")=<externalptr> 
library(dplyr)
library(tidyr)
life_exp <- worldlife_exp$`Life Expectancy World Bank`
health_exp <- worldlife_exp$`Health Expenditure %`
education_exp <- worldlife_exp$`Education Expenditure %`

What is the highest life expectancy region and country?

What is the average life expectancy region and country?