Lesson 9 · Prepare data

What you will learn in this lesson

- How to rename and drop a column in a data frame
- How to display the names of the columns in a data frame
- How to use the pipe operator
- How to use indentation, and why it makes code easier to debug
- How to create new columns in a data frame
- How to merge multiple data frames into one

In the previous lesson (lesson 8), we have imported three files stored in three different variables: gdp_raw, population_raw and roads_raw. To continue our work, we need to merge them in a single data frame. Let’s call this unified data frame dep_all. In order to merge the data frames, we need to structure all three similarly. We will prepare each variable first, and then we will do the merging.

One aspect where the Tidyverse shines is when it comes to importing and preparing data. Almost all the functions we will use in this lesson comes from the Tidyverse.