Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction to data frames
Data frame structure
6. Column names
Accessing columns in a data frame
Accessing rows and columns combined in a data frame
Data frame analysis
Summary

Instruction

Great! With nrow() and ncol(), you can tell how big your data frame is. One important function that allows you to familiarize yourself with a data frame is the names() function. This function takes a data frame and displays the names of all of its columns. So, if you make a call to

names(cities)
R will print a character vector:

[1] "country" "city" "latitude" "longitude" "population"

The length of this vector is 5 because we have 5 columns in the cities data frame.

Exercise

Display the column names of the countries data frame.