There are currently at least 3 separate issues that may be preventing people from installing the
tidyverse package (if your installation compiles from source), or loading it after installation (if you use pre-compiled binaries). I’ll cover the problems along with solutions, but also list some temporary workarounds at the bottom of this post if you can’t use the given solutions for any reason. These problems are all fixed in the development version of the package (instructions for installing below), but for those teaching classes or otherwise needing more straightforward solutions right now, knowing workarounds/fixes may be useful until then.
- Upgrade to the current version of RStudio. If you are using a pre-1.1 version of the RStudio IDE, you’ll get the error:
library(tidyverse) Error : .onAttach failed in attachNamespace() for ‘tidyverse’, details: call: NULL error: Function getThemeInfo not found in RStudio Error: package or namespace load failed for ‘tidyverse’
The only non-workaround is to upgrade your IDE, if you can.
Update your other packages. Older versions of the
purrrpackages will cause issues, and potentially others. You can do this with the “Update” button in the RStudio IDE:
Just make sure you de-select the
tidyversepackage for the initial update, if you compile from source.
Select an editor theme for RStudio. Under Tools → Global Options → Appearance, you will see a list of “Editor Themes”. Some people’s installs somehow fail to have a theme selected, which causes the error below. Selecting any of the themes (you are likely defaulted to TextMate if you have this bug) will fix the issue. Just make sure to hit “OK” after selecting!
Error: package or namespace load failed for ‘tidyverse’: .onAttach failed in attachNamespace() for 'tidyverse', details: call: if (theme$dark) crayon::white(x) else crayon::black(x) error: missing value where TRUE/FALSE needed
If the solution to your problem isn’t listed, or you can’t use the solutions provided due to not having full control over your R/RStudio installation, then you should downgrade the
tidyverse package for now (thanks to @JeffR for the instructions):
if (!require("devtools")) install.packages("devtools") devtools::install_version(“tidyverse”, version = “1.1.1”, repos = “http://cran.us.r-project.org”)
If you prefer to live on the edge and install from the source on Github, these problems are already fixed in the development version. However, installing that with the command below will likely also install development versions of other packages as well, so buyer beware!
if (!require("devtools")) install.packages("devtools") devtools::install_github("tidyverse/tidyverse")
Alternatively, you can always avoid using the
tidyverse package by individually loading packages such as
purrr, but that has its own annoyances.
This post summarizes the troubleshooting from the following threads, put here to make them linked to this thread. Thanks to all that did some back-and-forth with me to figure these out!