Image

What is the 'tidyverse'?

The ‘tidyverse’ is the umbrella name for a collection of specific R packages. We briefly described packages in the “Importing data: the basics” guide; a package is basically an add-on for R that someone has made, giving us access to new features that are not available in 'base' R code.

Normally, we install packages individually. For example, we might install the ‘captioner’ package, which will then allow us to automate the captions found under our tables and figures (see: 5 reasons to write documents in R). When installing the tidyverse, however, a bunch of packages are all installed at the same time. These packages work in harmony with one another, and include:

  • readr;
  • tidyr;
  • dplyr;
  • ggplot2;
  • tibble;
  • purrr;
  • stringr;
  • forcats.

We won't get into what each of these do...but after installing and loading the tidyverse using the following code, we’ll automatically have access to all of the packages listed above:

  
    install.packages(‘tidyverse’)
    library(tidyverse)
  

Each of the packages contained within the tidyverse use the same syntax - a certain way of writing R code that has a complete emphasis on clarity. Code written in the tidyverse syntax is designed to be as easy as possible to read; when shared with others, it allows people to follow along and understand every step of our script.

A huge part of this syntax is the 'pipe' operator: %>%. This is explained in more detail in the Selecting data guide, but it's a powerful tool that lets us make many changes to data in just a single step. This helps immensely in allowing others to understand our code.

And that's pretty much it. Not as complicated as it first sounded, huh?



Comment Form is loading comments...

More articles:

01

5 reasons to write documents in R.

02

What is the 'tidyverse'?

See All Articles