Question: #Load the gapminder dataset #If you have not already installed the gapminder package and you try to load it using the following code, # you

#Load the gapminder dataset

#If you have not already installed the gapminder package and you try to load it using the following code, # you will get an error: Error in library(gapminder) : there is no package called gapminder

#If this happens, install the gapminder package by running install.packages("gapminder") in your console.

#Once youve done this, run the following code to load the gapminder dataset, the ggplot2 library, # and a helper library for printing the contents of gapminder: library(gapminder) library(ggplot2) library(tibble)

#A function to allow you to see the underlying data. i.e all possible columns in your data frame. glimpse(gapminder)

#a. Generate a histogram of life expectancy. Hint: aes(x= lifeExp) #

#b. Generate separate histograms of life expectancy for each continent. Hint: facet_wrap(~ continent) #

#c. Compare the distribution of life expectancy, by continent by generating a boxplot. # Hint: aes(x = continent, y = lifeExp)) #

#d. Re-draw the plot in 5.c. above but this time use a violin plot. #

# e. Generate a scatterplot of the relationship between per capita GDP and life expectancy.

#

#f. Add a smoothing line to the scatterplot

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!