Package load failed: cannot open file; R crash

Hello,
I have been having trouble loading my libraries in R studio. It started when a package that was supposedly loaded did not open.

library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in get(Info[i, 1], envir = env):
cannot open file '\isad.isadroot.ex.ac.uk/UOE/User/R/win-library/4.0/rlang/R/rlang.rdb': Invalid argument

I am using a work computer. I have done the following sequentially without getting any success:

  • installed the latest R version and re-started a new R studio session. I tryed by using installr and then installed manually.
  • remove.packages("ggplot2");install.packages("ggplot2") and re-start a session
  • re-install all packages
  • install tidyverse (as it comprises ggplot2 if I understood correctly) and try to load it
  • copying the R folder to my C: and changed the folder directory

This error appeared too

library(dplyr)

Attaching package: ‘dplyr’

The following object is masked from ‘package:nlme’:

collapse

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

This error message runs endlessly and made Rstudio crash

library(lme4)
library(blme)

Error: package or namespace load failed for ‘lme4’ in get(Info[i, 1], envir = env):
cannot open file '\isad.isadroot.ex.ac.uk/UOE/User/R/win-library/4.0/Rcpp/R/Rcpp.rdb': Invalid argument
Failed with error: ‘package ‘lme4’ could not be loaded’
Error in .requirePackage(package) :
unable to find required package ‘blme’
Loading required package: blme
Loading required package: lme4

Could anyone please help me with this?

Your package library seems to be set on a network drive, R has issues with this very frequently. I recommend you to set your package library on a local folder.

You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file

# In a .Renviron file you can set it by adding this line
R_LIBS_SITE="C:\\Program Files\\R\\R-4.0.3\\library"

For a more detailed explanation, you can read this blog post

Thanks. I did this, then uninstalled and re installed R and R studio, and now it works.

This topic was automatically closed 7 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.