Nesting your data
In this course, you will work with a collection of economic and social indicators for 77 countries over a period of 52 years. This data is stored in the gapminder data frame.
In this exercise, you will transform your gapminder data into a nested data frame by using the first tool needed to build the foundation of tidy machine learning skills: nest().
Note: This is a more granular version than the dataset available from the gapminder package. This version is available in the dslabs package.
Cet exercice fait partie du cours
<cours>Machine Learning in the Tidyverse</cours>Instructions de l’exercice
- Take a look at the first six rows of
gapminder. - Now leverage
group_by()andnest()to nest your data frames bycountry, save this asgap_nested. - Explore the first six rows of the newly created data frame
gap_nested, note the new complex column data containing tibbles.
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# Explore gapminder
head(___)
# Prepare the nested data frame gap_nested
library(tidyverse)
gap_nested <- gapminder %>%
group_by(___) %>%
___()
# Explore gap_nested
head(___)