I am unable to install packages through latest version of RStudio and R Version.3.1.1.
Kindly help. I got the error as mentioned below:
Example:
Warning in install.packages :
InternetOpenUrl failed: ''
Warning in install.packages :
InternetOpenUrl failed: ''
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1
Installing package into ‘C:/Users/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
InternetOpenUrl failed: ''
Warning in install.packages :
InternetOpenUrl failed: ''
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1
Warning in install.packages :
package ‘reshape’ is not available (for R version 3.1.1)
This question is related to
r
If you are on Windows, try this:
"C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/
Based on answers from the community, there appear to be several ways that might solve this:
install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
http_proxy=http://host:port/
:"C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/
I think this is the "set it and forget it" solution:
options(repos='http://cran.rstudio.com/')
Note that this isn't https. I was on a Linux machine, ssh'ing in. If I used https, it didn't work.
My solution that worked was to open R studio options and select global miror (the field was empty before) and the error went away.
Not 100% certain that you have the same problem, but I found out the hard way that my job blocks each mirror site option that was offered and I was getting errors like this:
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
Warning: unable to access index for repository https://rweb.crmda.ku.edu/cran/src/contrib
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.2)
Workaround (I am using CentOS)...
install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
I hope this saves someone hours of frustration.
What worked for me:
Preferences-General-Default working directory-Browse Switch from global to local mirror
Working on a Mac. 10.10.3
As @Pascal said, it is likely that you encounter problem with the firewall or/and proxy issue. As a first step, go through FAQ on the CRAN web page. After that, try to flag R with --internet2.
Sometimes it could be useful to check global options in R studio and uncheck "Use Internet Explorer library/proxy for HTTP". Tools -> Global Options -> Packages and unchecking the "Use Internet Explorer library/proxy for HTTP" option.
Hope this helps.
Please check the following to be able to install new packages:
1- In Tools -> Global Options -> Packages, uncheck the "Use Internet Explorer library/proxy for HTTP" option,
2- In Tools -> Global Options -> Packages, change the CRAN mirror to "0- Cloud - Rstudio, automatic redirection to servers worldwide"
3- Restart Rstudio.
4- Have fun!
Most of the time @cer solution works but if in case its not working then try installing it in base R (NOT in R studio). As R studio runs base R executable in background so new package will be available in R studio as well. [my experience in macOS]
Source: Stackoverflow.com