library(ggplot2)
library(gapminder)
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
gapminder2<-slice_max(gapminder, year, n = 142, na_rm = TRUE)
summary(gapminder2)
## country continent year lifeExp
## Afghanistan: 1 Africa :52 Min. :2007 Min. :39.61
## Albania : 1 Americas:25 1st Qu.:2007 1st Qu.:57.16
## Algeria : 1 Asia :33 Median :2007 Median :71.94
## Angola : 1 Europe :30 Mean :2007 Mean :67.01
## Argentina : 1 Oceania : 2 3rd Qu.:2007 3rd Qu.:76.41
## Australia : 1 Max. :2007 Max. :82.60
## (Other) :136
## pop gdpPercap
## Min. :1.996e+05 Min. : 277.6
## 1st Qu.:4.508e+06 1st Qu.: 1624.8
## Median :1.052e+07 Median : 6124.4
## Mean :4.402e+07 Mean :11680.1
## 3rd Qu.:3.121e+07 3rd Qu.:18008.8
## Max. :1.319e+09 Max. :49357.2
##
ggplot(data = gapminder2, mapping = aes(x = continent, y = lifeExp)) + geom_boxplot() + labs(title = "Life Expectancy by Continent, 2007", x = "Continent", y = "Life Expectancy in Years")
"As seen with the above statistics on central tendancies of national life expectancies, less than six years of life expectancy is between the maximum national average life expectancy and the third quartile. The distance between the first quartile and the minimum however is over 15 years, implying that life expectancy is negatively skewed and many countries are clustered near the top in terms of longest average lives."
## [1] "As seen with the above statistics on central tendancies of national life expectancies, less than six years of life expectancy is between the maximum national average life expectancy and the third quartile. The distance between the first quartile and the minimum however is over 15 years, implying that life expectancy is negatively skewed and many countries are clustered near the top in terms of longest average lives."
I did it!