Chapter 16 Bonus chapter: tidyverse

If you continue to work in R, you will undoubtedly come across a collection of packages called tidyverse. It’s a group of packages that are used to manipulate data and they all use the same underlying design philosophy, grammar, and data structures. There are different schools of thought - some like the user-friendliness of tidyverse and how intuitive its functions are, some don’t like how it changes the language structure of R and how it introduces its own syntax. You will make up your own mind about this in the future, but in any case it will be helpful for you to know tidyverse, so you can read and understand scripts of other people using this syntax.

The tidyverse is built up from multiple packages and is still expanding. The most well-known packages are dplyr for data manipulation and ggplot2 for data plotting. tidyr is useful for reshaping data (long/wide format).

Tidyverse logo from https://www.tidyverse.org/

Figure 16.1: Tidyverse logo from https://www.tidyverse.org/

In this bonus chapter, we will quickly introduce the most common dplyr functions and some other handy tidyverse tricks. If you are interested in a more in-depth look at the topic, there are many free online resources such this one here. The plotting package ggplot is discussed in another bonus chapter.

Of course, you will have to install tidyverse before we begin: install.packages("tidyverse")