1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to R

Exercise

Quick, have a look at your dataset

Wow, that is a lot of cars!

Working with large datasets is not uncommon in data analysis. When you work with (extremely) large datasets and data frames, your first task as a data analyst is to develop a clear understanding of its structure and main elements. Therefore, it is often useful to show only a small part of the entire dataset.

So how to do this in R? Well, the function head() enables you to show the first observations of a data frame. Similarly, the function tail() prints out the last observations in your dataset.

Both head() and tail() print a top line called the 'header', which contains the names of the different variables in your dataset.

Instructions

100 XP

Call head() on the mtcars dataset to have a look at the header and the first observations.