On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction to data frames
Data frame structure
Accessing columns in a data frame
Accessing rows and columns combined in a data frame
21. Accessing rows and several columns
Data frame analysis


Perfect! In the previous exercise, we retrieved only one column but you can certainly retrieve more columns by listing their names (or indexes) inside the c() function. For example, the expression

cities[cities$population > 3000000, c("city", "population")]

will retrieve city names and populations for cities with more than 3 million inhabitants.


Extract the names and populations of countries that have more than 20 million inhabitants.

Stuck? Here's a hint!

The information about populations is stored in the population column. The names of countries are stored in the country column.