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
Data frame analysis
25. Numeric column visualization - histograms
Summary

Instruction

Well done! Of course, you can also visualize data that are stored in each column. For numeric values, you can use histograms. Recall that you can draw a histogram using hist(). We'll use the dollar sign ($) to specify the column we wish to visualize:

hist(cities$population)

This will display a histogram of population values to the output console:

histogram_picture

As you can see from the picture, most of the candidate cities have less than one million inhabitants, but there are still some outliers that are heavily populated (like Paris and Berlin).

Exercise

What does the distribution look like for country populations? Given that population values are stored for each country in the population column of the countries data frame, display a histogram of that population data.

Stuck? Here's a hint!

Use the hist() function on the population column from the countries data frame.