Chapter 3 Summarising data

“The Answer to the Great Question … Of Life, the Universe and Everything … Is … Forty-two,” said Deep Thought, with infinite majesty and calm.
Douglas Adams, The Hitchhiker’s Guide to the Galaxy

In this chapter you will find out how to:

  • summarise data using: group_by(), summarise(), and mutate();
  • reshape data between the wide and long formats: pivot_wider() and pivot_longer();
  • select() columns and arrange() (sort) rows.

The exercises at the end of this chapter combine all of the above to give context and show you more worked examples.