Library(tidyverse) results in error on R Studio

tidyverse
rstudio

#1

After successfully installing tidyverse with all its dependencies, when loading the package, the following error is given. How can I fix this?

> library(tidyverse)
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

UPDATE: I was recommended to move this to here.
UPDATE: If R GUI is used instead of R Studio, tidyverse loads without a problem. The issue is when library(tidyverse) gives an error when used in R Studio.


Tidyverse package v1.2.0 installation/loading solutions
#2

See here:

Otherwise, what version of RStudio do you have?


#3

Thank you Nick. Installing crayon did not do the trick unfortunately. See below. The version of the R studio is 1.1.383.

error4


#4

I’m having the exact same problem.

sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)

It does not resolve even after successfully installing ‘crayon’ .
Rstudio Version: 1.1.383


#5

@cavusogh and @dd_rookie, what are your settings under Tools -> Global Options -> Appearance? Also, what is the output when you run this function:

rstudioapi::getThemeInfo()

It’s not clear why theme$dark would be missing in the latest version of RStudio (which you’re running).


#6

Have you tried installing the development version of tidyverse from GitHub?

# install.packages("devtools")
devtools::install_github("tidyverse/tidyverse")

#7

Yes. The issue is not that tidyverse is not installed. If I go to R GUI (not R Studio), loading tidyverse would work. The issue is that library(tidyverse) will give the error shown above if you want to load it in R Studio.


#8

Hmm, ok. Perhaps move this over to the IDE category?


#9

@nick here is Appearance:


#10

here is the theme info:
theme info copy


#11

Some of my students have seen that this week. It seems to be connected with tidyverse 1.2.0. The solution I found was to go back into the past (rather than forward into the future): find the .tar.gz of 1.1.1, download it, then something like

f=file.choose() # to find the file on the user’s system (eg. Downloads)
install.packages(f,repos=NULL) # use the one downloaded rather than get it from anywhere

This last runs disturbingly quickly and silently, but when I’ve done it, it seems to work.


#13

Mine looks like:

and the output of getThemeInfo():

> rstudioapi::getThemeInfo()
$editor
NULL

$global
[1] "Modern"

$dark
[1] NA

#14

Done that. But as @cavusogh writes, if I launch a separate console session, it loads up correctly.


#15

@dd_rookie, that’s what I was expecting to see. Can you try selecting an “Editor theme” in the Appearance options (I think TextMate should match your current theme), and then see if you can load the 1.2.0 version of tidyverse? It looks like your theme was somehow deselected.

@cavusogh, it’s possible that your theme got properly set when you checked the options? You may be able to load the new tidyverse version now, since getThemeInfo()$dark isn’t NULL.


#16

Thanks @nick. Now, it seems to work well, after I switched to TextMate. And the getThemeInfo()$dark is no longer NULL.

I’m, finally, relieved to see the usual conflicts and warning messages :laughing::


-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
Warning messages:
1: package ‘tidyr’ was built under R version 3.4.2 
2: package ‘purrr’ was built under R version 3.4.2 
3: package ‘dplyr’ was built under R version 3.4.2 
4: package ‘forcats’ was built under R version 3.4.2

#17

Glad to hear that fixed the problem. This would appear to be an issue with rstudioapi (that the theme can be NULL) that would have to be worked around in tidyverse. The problem is reproducing it, since I doubt it would occur on a fresh install.


#18

I’m not able to reproduce it on my machine, but I ran a workshop with >40 people mostly new installations of R, RStudio (on Wednesday), and more than half of the attendees had this error crop up. Workaround by loading packages individually.


#19

I can also reproduce this error. installing dev versions of rstudioapi, crayon, tidyverse all have no effect. Simply choosing a color theme in the RStudio global options menu (e.g. re-selecting the default theme) fixes this for me.


#20

Glad to hear re-choosing a theme worked. I filed an issue under rstudioapi for the problem (and an associated one for tidyverse), but that doesn’t help people trying to use it right now.

@atiretoo, if you have any more workshops before the next version of the tidyverse package is released, I’ve listed some solutions to the problems we’ve seen on this forum at this umbrella post.


#21

Same problem here on RStudio server:

> rstudioapi::getThemeInfo()
Error: Function getThemeInfo not found in RStudio

I will try to download a previous version of tidyverse