Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!
Create new variables
4. Create a new column
Grouping and statistical functions
Joining datasets


Good job! But one more thing – we need to assign this result to a new variable!

To assign data to a variable calculated by %>%, we start with the new variable name. Next, we list the dataset and write the operation(s) that will generate the data.

In our earlier example, this would be:

countries2 <-
  countries %>%
  mutate(america = if_else(continent == "North America" | continent == "South America",


Assign the result of the query from the previous exercise to the countries_urban variable.

Stuck? Here's a hint!


countries_urban <- countries %>%
  mutate(urban_country = if_else(urban_pop_pc >= 65, TRUE, FALSE))