Data description

The Gapminder dataset contains the health and income outcomes for 184 countries from 1960 to 2016. This data shows the inquality in overall quality of life in across the world, and how basic health has changed from 1960 to 2016. The source of this data is not listed in the help file, and after some googling I was still unable to find the source.

Summary table template:

Variable Description Type
country what country the data is coming from fct
year what year the data is coming from int
infant_mortality infant deaths per 1000 babies dbl
life_expectancy life expectancy for children born in this year given in years dbl
fertility average number of children born per women dbl
population population of the given country dbl
gpd Gross Domestic Product dbl
continent what continent the country is in fct
region Geographical region the country is in fct

Data visualizations

# Write R code here to load your data file
library(dslabs)
library(ggplot2)
# Write R code here to create your first plot
ggplot(data = gapminder) + geom_point(aes(x = gdp, y = infant_mortality, color = continent)) + labs(x = "Gross Domestic Product", y= "Infant Mortality Rate", title = 'GDP vs Infant Mortality rate')
## Warning: Removed 3406 rows containing missing values (geom_point).

This graph shows the relationship between GDP and infant mortality rate with the continent represented through the color of each point. You can see that gpd is expotentially related to infant mortality rate. As the GDP of a country increases the infant mortailty rate decreases to almost zero.

# Write R code here to create your second plot
gapMinder2 <- gapminder %>%
  filter(country == "Aruba")
  
  
ggplot(data = gapMinder2) +
  geom_bar(aes(x = year, y = fertility, color = 'Red'), stat = 'identity') +
  labs(x = 'Year',
       y = 'Fertility in Aruba',
       title = 'Fertility in Aruba over Time')
## Warning: Removed 1 rows containing missing values (position_stack).

This bar chart shows that between 1960 and 1980 that fertility in Aruba steadily decreases and then levels from the 80s until now.