Practise the tibble and dplyr style from The Tibble Format on the built-in mtcars data.

The program reads a number of cylinders (4, 6 or 8). Using the pipe |>:

  1. Turn mtcars into a tibble with as_tibble().
  2. filter() it to cars with that many cylinders.
  3. summarise() three values: the number of cars (n()), the mean mpg rounded to 1 decimal place, and the maximum hp.

Print the result as:

Cars: 11
Mean mpg: 26.7
Max hp: 113

Try printing the tibble itself with print() before you summarise. How does it look different from a plain data frame?

You do not have permission to attempt this activity.