How to fix the there is no package called ‘tidyverse’ error in R?

Today we will learn how to fix error messages that you could find in your R development tool such as RStudio, Jupyter and others, when trying to invoke the tidyverse library without it being installed.

Understanding the error

  • Open RStudio or Jupyter or other R script development environment.
  • Create your script.
  • Invoke the tidyverse environment : library(tidyverse)
  • The Console will return the following exception message:
Error in library(tidyverse) : there is no package called ‘tidyverse’

Here’s a screenshot from the RStudio Console tab in my Windows computer. Same error will be thrown in Ubuntu and macOS.

The root cause is that you are trying to invoke tidyverse but the library is not yet installed in your computer. Reason for that is that when you install RStudio tidyverse is not installed by default and has to be added manually.

Fix the Error in library(tidyverse) in RStudio

Luckily, solving this error is pretty simple: we just need to install tidyverse:


Important Note: Make sure to include the quotation marks around the library name. Failing to do so will invoke the following error: Error in install.packages : object ‘tidyverse’ not found

RStudio will install all the packages that compose tidyverse such as dplyr, purrr, broom, fs, reprex, highr, selectr, readr etc.

Next, you can invoke tidyverse and use its sub-packages in your R script: