When we wish to build familiarity with a new dataset, rather than running multiple commands to get the data frame’s size, column names, and column data types individually, it would be efficient if we can obtain a consolidated summary covering these common data frame structure aspects with one command. Luckily, we can do just that.
df %>% glimpse()
Here is how this works:
df
to the glimpse()
function.glimpse()
returns a helpful overall summary of a data frame that contains: column names, column count, row count, column data types, and the first few observations from each column.glimpse()
from dplyr
is a better alternative to base R’s str()
.