Introduction to data frames
Data frame structure
Accessing columns in a data frame
Accessing rows of a data frame
Accessing rows and columns combined in a data frame
Data frame analysis
35. Self-study ideas


You did an excellent job solving all these exercises! Congrats!

If you would like to learn and practice more by yourself, here is a self-study idea.

The installation of R comes with many data sets that you can load into your current R workspace with help of the data() function. By typing data() in the R editor (without arguments), R will retrieve all data set names that are available for loading and usage. If you explicitly define a data set name as the data() function's argument, R will load the specified data into your R environment, and you will be able to use it in your analysis.

A good example of one of the several available data sets in R is USArrests. This data frame contains information about arrests related to assault, murder, and rape (per 100000 residents) in each of the 50 US states in 1973. Also, for each state, the data frame specifies the percent of the population living in urban areas. If you want to further test your knowledge of what we learned in this part of the course, you can do the following:

  • Load the USArrests data set into the R workspace so you can use it in your analysis. To do so, use the data() function with the argument as USArrests (in a plaintext format, not as a string). For more details, check out the official R documentation for data() and USArrests.
  • Observe your data set. How many columns and rows does it have? How big is the table? What are its column names?
  • Draw a histogram of the variable UrbanPop (population percent in urban areas), and check the distribution of that variable. Draw histograms for other numeric variables if you like.
  • Calculate basic statistics like maximum, minimum, median, mean, quantiles, and summary on the table's numeric columns.

After you've done all that, you will probably be able to answer the following questions:

  1. Which state had the most murder arrests per 100000 residents in 1973?
  2. Which state had the highest population percent in urban areas?
  3. Which state had the fewest assault arrests?

Of course, there are many more real-world facts you can observe by running some analyses on the data frame. This is a good opportunity to get creative and practice your skills. Have fun exploring the data!


Click Next Exercise to continue.