Can't install tidyverse

Hi out there, I am a complete novice to RStudio and started a tutorial but hit a wall on the first day as I can't seem to install the tidyverse package. I went through some of the previous posts with similar problems but they were (or to me they looked) all slightly different. As I have no idea where to start let me paste the output from where the error messages start. Hopefully someone out here can point me in the right direction. I should say that I work on a Macbook, Mojave 10.14.6 and have updated RStudio to version 1.3.1073 as this seemed the most obvious first step. Many thanks for even looking at my issue when so many had it before.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

ERROR: compilation failed for package β€˜rlang’

  • removing β€˜/Users/reiling/Library/R/3.5/library/rlang’

  • restoring previous β€˜/Users/reiling/Library/R/3.5/library/rlang’

Warning in install.packages :

installation of package β€˜rlang’ had non-zero exit status

  • installing source package β€˜tidyselect’ ...

** package β€˜tidyselect’ successfully unpacked and MD5 sums checked

** R

** inst

** byte-compile and prepare package for lazy loading

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :

namespace β€˜rlang’ 0.4.5 is being loaded, but >= 0.4.6 is required

ERROR: lazy loading failed for package β€˜tidyselect’

  • removing β€˜/Users/reiling/Library/R/3.5/library/tidyselect’

Warning in install.packages :

installation of package β€˜tidyselect’ had non-zero exit status

ERROR: dependency β€˜tidyselect’ is not available for package β€˜dbplyr’

  • removing β€˜/Users/reiling/Library/R/3.5/library/dbplyr’

Warning in install.packages :

installation of package β€˜dbplyr’ had non-zero exit status

ERROR: dependency β€˜tidyselect’ is not available for package β€˜modelr’

  • removing β€˜/Users/reiling/Library/R/3.5/library/modelr’

Warning in install.packages :

installation of package β€˜modelr’ had non-zero exit status

You require the XCode.app and, once installed, from the terminal

xcode-select --install 

From the R console

install.packages("tidyverse")(

Thanks so much! Only one error message now which is this

Error in list2(...) : object '%>%' not found
Error : unable to load R code in package β€˜dbplyr’
ERROR: lazy loading failed for package β€˜dbplyr’

  • removing β€˜/Users/reiling/Library/R/3.5/library/dbplyr’
    ...

and then this upon trying to load:

library(tidyverse)
Error: package or namespace load failed for β€˜tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called β€˜dbplyr’
In addition: Warning message:
package β€˜tidyverse’ was built under R version 3.5.2

install.packages("dpylr")

Cheers! Many thanks! I finally got it (I think). I was able to install dbplyr but only after installing tibble and then also fs. Finally tidyverse seems to be working for me, however I still got this message after loading: Is it something I have to worry about or just wait until I run into the next acute problem?

library(tidyverse)
── Attaching packages ─────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
βœ“ ggplot2 3.3.2 βœ“ dplyr 0.8.5
βœ“ tidyr 1.0.2 βœ“ stringr 1.4.0
βœ“ readr 1.3.1 βœ“ forcats 0.5.0
βœ“ purrr 0.3.3
── Conflicts ────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::filter() masks stats::filter()
x dplyr::ident() masks dbplyr::ident()
x dplyr::lag() masks stats::lag()
x dplyr::sql() masks dbplyr::sql()
Warning messages:
1: package β€˜tidyverse’ was built under R version 3.5.2
2: package β€˜tidyr’ was built under R version 3.5.2
3: package β€˜purrr’ was built under R version 3.5.2
4: package β€˜dplyr’ was built under R version 3.5.2
5: package β€˜stringr’ was built under R version 3.5.2
6: package β€˜forcats’ was built under R version 3.5.2

Those are just warnings and don't pose problems.

FYI,
Every once in a while, the function conflicts will bite you in the butt.
When you install multiple packages with a function with the same name
[ like dplyr::ident() and dbplyr::ident() ]
whichever one is installed last takes precedent
(masks the preceding one).
So R will assume when you use filter() that you always mean the one from dplyr

Once in a while, you will have intended the filter() from dbplyr, and it will get confusing, and sometimes produce unexpected results.

It doesn't happen that often, but it happens rarely enough that it is confusing, because you learn to ignore these warnings, and forget about them.

Three workarounds I find helpful:

  1. Make sure to install your preferred package last
  2. Use the package::function format when you want to be specific, e.g. dbplyr::filter will run the filter function from dbplyr, and dplyr::filter will run the filter function from dplyr
  3. Install and use the {conflicted} package to set your preferences
1 Like

Ok that makes sense. Very helpful, I think I am starting to get my head around it all a little more. Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.