Introduction to data frames
Data frame structure
Accessing columns in a data frame
Accessing rows and columns combined in a data frame
Data frame analysis
30. Exercise 1


Versico has decided to analyze the GDPs (gross domestic product) of its candidate European countries. The Versico executives would like to grow their business in markets with highly populated cities that also generate high GDP.

The goal of the few exercises that follow is to select cities from the cities data frame that are located in the countries with the highest GDPs. You will identify which country has the highest GDP in Eastern Europe and which country has the highest GDP in Western Europe.

You will then use the cities data frame to retrieve a list of candidate cities from these two countries. The countries_gdp data frame has already been prepared for you.


Explore the countries_gdp data frame. Take a look at the contents with the head() function. To start things off, display the first 10 rows of the countries_gdp data frame and familiarize yourself with the table. Try answering the following questions:

  • How many countries are in the countries_gdp data frame?

  • How many columns are in the countries_gdp data frame?