Problem with loading "tidyverse"

Hi,
I'm completely new to R and I have difficulties in loading the "tidyverse" package. The installation seems to have worked but when I try to load it, I get the error that the package "haven" is missing and I can't install that one. I've removed tidyverse and retried it with a clean start for several times now but it just doesn't work.
Can anybody please help?

Here is my code:

> install.packages("tidyverse")
also installing the dependency ‘haven’
try URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip'
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip'
Warning in install.packages :
  download of package ‘haven’ failed
try URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.1.zip'
Content type 'application/zip' length 429963 bytes (419 KB)
downloaded 419 KB

package ‘tidyverse’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\julia\AppData\Local\Temp\Rtmp00ujTf\downloaded_packages

> 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 named ‘haven’

> install.packages("haven")
try URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip'
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/haven_2.4.1.zip' 
Warning in install.packages :
  download of package ‘haven’ failed

After using tidyverse for months my loads are also failing, except mine fail on some conflict with the "broom" version, and updates are failing with no error messages. Other than the specific packages, my fails have similar error messages. And I've also tried reinstalling, using the command line version of R, nothing works.

EDIT: Here's the sequence I've been going through, with the fails.

install.packages(c("broom", "callr", "cli", "cpp11", "dbplyr", "haven", "highr", "knitr", "pillar", "processx", "RcppArmadillo", "reprex", "tibble", "tinytex", "vctrs", "viridis", "viridisLite", "withr"))
Install system packages...

install.packages("tidyverse")
Install system packages...

library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘broom’ 0.7.5 is being loaded, but >= 0.7.6 is required
install.packages("broom")
Install system packages...

This seems like a connectivity issue, R is not being able to connect to the CRAN repository you have selected, these are some things to try.

  • Choose a different CRAN repository, RStudios repository is a good choice (http://cran.rstudio.com/) or you could choose one that is geographically closer to you.
  • Disable secure download setting.
  • Check if your internet connection has traffic restrictions of some kind, like a firewall, proxy server, etc. This is usually the case when you are at work or school.
2 Likes

Thank you very much for responding so quickly!
I've just opened R again, retried installing and loading it - and it worked! I've now idea why, just glad it does!
Thank you very much for your problem-fixing-solutions - maybe (hopefully not) I'll need them at some other time.

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.