How do I resolve "Warning: unable to access index for repository"?

Viewed 9177

I cannot install almost all packages such as dplyr too.

It also mentioned that my C drive is not writable. How do I solve this issue?

My codes are as follows.

install.packages("kernlab")
Installing package into ‘C:/Users/EliteBook 8440p/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository https://wbc.upm.edu.my/cran/src/contrib:
  cannot open URL 'https://wbc.upm.edu.my/cran/src/contrib/PACKAGES'
Warning: unable to access index for repository https://wbc.upm.edu.my/cran/bin/windows/contrib/4.0:
  cannot open URL 'https://wbc.upm.edu.my/cran/bin/windows/contrib/4.0/PACKAGES'
Warning message:
package ‘kernlab’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 
1 Answers

It looks like it is not your local drive but rather that you cannot access that CRAN mirror (https://wbc.upm.edu.my/cran/bin/windows/contrib/4.0/PACKAGES) to download the {kernlab} package.

Warning: unable to access index for repository

Try manually specifying the repos argument and using the RStudio mirror:

install.packages('kernlab', dependencies=TRUE, repos='http://cran.rstudio.com/')

There are many mirrors that you can source CRAN packages from. Depending on your IT setup, you may not have permission to access all of them. So, manually specifying the download location is one way, you can also set options(repos='http://cran.rstudio.com/') in your .Rprofile.

Another possible wrinkle if you are using RStudio are the Global Options >> Packages settings defining your primary CRAN repository and whether or not you use HTTPS. I would check all of the above things.

Related