user366312
user366312

Reputation: 16908

How can I install readxl package for R?

I am trying to install readxl package for R.

The following is the RStudio output:

To learn more and/or disable this warning message see the "Use secure download method for HTTP" option in Tools -> Global Options -> Packages.
> library('readxl')
Error in library("readxl") : there is no package called ‘readxl’
> install.packages("readxl")
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/src/contrib:
  cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Installing package into ‘C:/Users/Lenovo/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/src/contrib:
  cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
  package ‘readxl’ is not available (for R version 3.5.0)
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.5:
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.5/PACKAGES'
> 

The following is the R's console output:

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("readxl")
Installing package into ‘C:/Users/Lenovo/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/PROGRA~1/R/R-35~1.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
  cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
Warning: unable to access index for repository https://cloud.r-project.org/bin/windows/contrib/3.5:
  cannot open URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
  InternetOpenUrl failed: ''
2: package ‘readxl’ is not available (for R version 3.5.0) 
> 

How can I solve this issue?

Upvotes: 0

Views: 6387

Answers (1)

Justin Stone
Justin Stone

Reputation: 31

The error messages definitely seem to be telling you, that R cannot connect to download the packages. Here are some thoughts:

  • Does your user profile have administrative privileges? I am not a huge Windows user, but your are technically trying to add software, which sometimes requires escalated privileges. Maybe trying running R as Admin in windows, for this one issue to see if that is the problem. (Doesn't seem very likely.)
  • If it is a firewall issue you could try to add an exception to your firewall settings for R and/or Cran repositories.
  • Have your tried to account for dependent packages? install.packages("readxl", dependencies = TRUE) (This can cause its own bag of issues as well, so consider yourself forewarned.)
  • Can you download any other packages? As you can access the internet to make stack posts, are asking a fairly entry level question, and the URL's are valid so there may be a configuration issue with your installation of R. If all else fails, you may wish to uninstall/reinstall R on your system (and Maybe R studio while you are at it) as that may help to repair something if it is damaged. Use the file checksums, the are there for a reason.

Upvotes: 1

Related Questions