Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close


In R, you can also store data in the form of a table known as a data frame. Simply put, a data frame is a list of vectors of equal length arranged side by side, like the columns of a table. Of course, sometimes our tables can be quite large, so displaying them in their entirety can be costly. Instead, we can take a look at the first few rows of a data frame by using the head() function, which simply takes the name of a data frame you want to display:


By default, head() will show you the first six rows, but you can get any number of rows just by passing it as the second argument, like so:

head(people, 15)


Look at the first few rows of the cars data frame using the head() function.

Stuck? Here's a hint!