When you load a new data frame from a CSV, you want to get an understanding of what the data looks like.
If the data frame is small, you can display it by typing its name
df. If the data frame is larger, it can be helpful to inspect a few rows of the data frame without having to look at the rest of it.
head() function returns the first 6 rows of a data frame. If you want to see more rows, you can pass an additional argument
head(). For example,
head(df,8) will show the first
summary() will return summary statistics such as mean, median, minimum and maximum for each numeric column while providing class and length information for non-numeric columns.
View the entire data frame by typing
artists in the empty code block and running the code.
Within the same code block, inspect
head(). How many rows are returned?
Still within the same code block, call
summary() on artists and run the code to view the summary statistics of the data frame.