LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Machine Learning in the Tidyverse

Kurs anzeigen

Anleitung zur Übung

  • Take a look at the first six rows of gapminder.
  • Now leverage group_by() and nest() to nest your data frames by country, save this as gap_nested.
  • Explore the first six rows of the newly created data frame gap_nested, note the new complex column data containing tibbles.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Explore gapminder
head(___)

# Prepare the nested data frame gap_nested
library(tidyverse)
gap_nested <- gapminder %>% 
  group_by(___) %>% 
  ___()

# Explore gap_nested
head(___)
Code bearbeiten und ausführen