IniziaInizia gratis

Comparing population and life expectancy

In this exercise, you'll use ggplot2 to create a scatter plot from scratch, to compare each country's population with its life expectancy in the year 1952.

Questo esercizio fa parte del corso

Introduction to the Tidyverse

Visualizza il corso

Istruzioni dell'esercizio

  • Create a scatter plot of gapminder_1952 with population (pop) is on the x-axis and life expectancy (lifeExp) on the y-axis.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

library(gapminder)
library(dplyr)
library(ggplot2)

gapminder_1952 <- gapminder %>%
  filter(year == 1952)

# Create a scatter plot with pop on the x-axis and lifeExp on the y-axis
Modifica ed esegui il codice