Inspecting dataframes
There are several functions you can use to inspect your dataframe. To name a few
-
head
: this by default prints the first 6 rows of the dataframe -
tail
: this by default prints the last 6 rows to the console -
str
: this prints the structure of your dataframe -
dim
: this by default prints the dimensions, that is, the number of rows and columns of your dataframe -
colnames
: this prints the names of the columns of your dataframe
This exercise is part of the course
Inferential Statistics
Exercise instructions
- Print the first 6 rows of mtcars
- Print the structure of the dataframe mtcars
- Print the dimensions of the dataframe mtcars
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# print the first 6 rows of mtcars
# print the structure of mtcars
# print the dimensions of mtcars