In this assignment, you’ll practice collaborating around a code project with GitHub. You could consider our collective work as building out a book of examples on how to use TidyVerse functions.
GitHub repository: https://github.com/peterkowalchuk/FALL2023TIDYVERSE
FiveThirtyEight.com datasets.
Kaggle datasets.
Your task here is to Extend an Existing Example. Using one of your classmate’s examples (as created above), extend his or her example with additional annotated code. (15 points)
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggthemes)
Life_expectancy <- read.csv("https://raw.githubusercontent.com/Meccamarshall/Data607/main/life_expectancy.csv")
colnames(Life_expectancy)
## [1] "Country" "Year" "Status"
## [4] "Population" "Hepatitis.B" "Measles"
## [7] "Polio" "Diphtheria" "HIV.AIDS"
## [10] "infant.deaths" "under.five.deaths" "Total.expenditure"
## [13] "GDP" "BMI" "thinness..1.19.years"
## [16] "Alcohol" "Schooling" "Life.expectancy"
Kenya_Population <- Life_expectancy%>%
filter(Country == "Kenya")%>%
ggplot(aes(Year, Population, group = 1)) + geom_point(na.rm=TRUE, color = "hotpink") + geom_line(na.rm=TRUE, color = "orange")+
labs(title = "Kenya Population Throughout the Years", x = "Year", y = "Population (million)")
Kenya_Population
HIV_deaths_Kenya <- Life_expectancy%>%
filter(Country == "Kenya")%>%
ggplot(aes(Year, HIV.AIDS, group = 1)) + geom_point(na.rm=TRUE, color = "hotpink") + geom_line(na.rm=TRUE, color = "orange")+
labs(title = "Kenya deaths caused by AIDS of the last 4-year-olds", x = "Year", y = "HIV/AIDS Deaths")
HIV_deaths_Kenya
## Kenya Life Expectancy
Kenya_Life_expectancy <- Life_expectancy%>%
filter(Country == "Kenya")%>%
ggplot(aes(Year, Life.expectancy, group = 1)) + geom_point(na.rm=TRUE, color = "hotpink") + geom_line(na.rm=TRUE, color = "orange")+
labs(title = "Kenya Life Expenctancy Throughout the Years", x = "Year", y = "Life expectancy")
Kenya_Life_expectancy