1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning in the Tidyverse

Exercise

Mapping many models

The gap_nested data frame available in your workspace contains the gapminder dataset nested by country.

You will use this data to build a linear model for each country to predict life expectancy using the year feature.

Note: The term feature is synonymous with the terms variable or predictor. It refers to an attribute of your data that can be used to build a machine learning model.

Instructions

100 XP
  • Build a linear model for each country predicting life_expectancy using the year feature. Use the lm() function for this and save this new data frame containing models as gap_models.
  • Extract the first model from this data frame and save this as algeria_model.
  • View the information about the model using summary().