CommencerCommencer gratuitement

Faceting the time series

Now you'll take a look at six countries. While in the previous exercise you used color to represent distinct countries, this gets a little too crowded with six.

Instead, you will facet, giving each country its own sub-plot. To do so, you add a facet_wrap() step after all of your layers.

Cet exercice fait partie du cours

Case Study: Exploratory Data Analysis in R

Afficher le cours

Instructions

  • Create a filtered version that contains these six countries called filtered_6_countries.
  • Use the filtered dataset (containing summarized data for six countries) to create a plot with one facet for each country.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Vector of six countries to examine
countries <- c("United States", "United Kingdom",
               "France", "Japan", "Brazil", "India")

# Filtered by_year_country: filtered_6_countries


# Line plot of % yes over time faceted by country
___(filtered_6_countries, ___) ___
  ___
  ___
Modifier et exécuter le code