Exploring Data Frames
Explore some commonly used functions used to view data in R.
We'll cover the following...
There are many ways to get an understanding of the data contained in a data frame such as flights. We present three functions that take as their argument (their input) the data frame in question. We also include a fourth method for exploring one particular column of a data frame:
Using the
print()function, which brings up the data viewerUsing the
glimpse()function, which is included in thedplyrpackageUsing the
kable()function, which is included in theknitrpackageUsing the
$“extraction operator,” which is used to view a single variable/column in a data frame
The print() function
We will run print(flights) in our console and explore this data frame in the resulting pop-up viewer. We should get into the habit of viewing any data frames we encounter.
Note: R is case-sensitive, so we’ll get an error message if we run
Print(flights)instead ofprint(flights)...