Quiz
This lesson is called Quiz, part of the R in 3 Months (Spring 2026) course. This lesson is called Quiz, part of the R in 3 Months (Spring 2026) course.
Test your knowledge with the questions below. Answers are not scored and do not affect your certification at the end of the program, so feel free to try as many times as you need. If you have any questions, don't hesitate to use the comments field or to contact Gracielle by email.
Quiz
What does the summarise() function do?
summarise() creates a new summary dataframe by calculating statistics (like mean, median, sum, count) and condensing your data into fewer rows. For example, summarise(avg_temp = mean(temperature)) would calculate the average temperature and return a single row with that value.
summarise() does not modify or update your dataframe. Instead, it creates a new dataframe with summary statistics. You can update your dataframe object by replacing it with this new summary table, but this would be an update of the object, not of your dataframe.
What is the purpose of group_by() when used with summarise()?
group_by() tells R to perform operations (like summarise) separately for each group. For example, group_by(country) |> summarise(avg_temp = mean(temperature)) would calculate the average temperature for each country separately. Remember to use ungroup() afterwards to remove the grouping.
Which function would you use to sort your data by temperature from highest to lowest?
arrange() is used to sort data. By default it sorts in ascending order, but you can use desc() to sort in descending order: arrange(desc(temperature)). Without desc(), arrange() would sort from lowest to highest.
Have any questions? Put them below and we will help you out!
Course Content
144 Lessons
You need to be signed-in to comment on this post. Login.