0

I am trying to install the Gains package in R Studio Version 3.1.2 like this: install.packages("gains")

The following warnings appear: InternetOpenUrl failed: 'The server name or address could not be resolved' Warning in install.packages :unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1 Warning in install.packages :package ‘gains’ is not available (for R version 3.1.2)

Does anyone know how can I fix this?

Thanks!

RodiX
  • 550
  • 5
  • 13
  • Seems relevant http://stackoverflow.com/questions/25599943/unable-to-install-packages-in-latest-version-of-rstudio-and-r-version-3-1-1 – Dason Jan 02 '15 at 18:21

1 Answers1

0

I believe that the problem lies in your corrupted, incomplete or otherwise incorrect R environment. I was able to install that package without any problems at all just by issuing the default command:

> install.packages("gains")
Installing package into ‘C:/Users/Alex/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/gains_1.1.zip'
Content type 'application/zip' length 35802 bytes (34 Kb)
opened URL
downloaded 34 Kb

package ‘gains’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Alex\AppData\Local\Temp\RtmpSSRths\downloaded_packages
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

loaded via a namespace (and not attached):
[1] tools_3.1.1

As a quick solution to the problem, I suggest to specify CRAN mirror explicitly:

install.packages("gains", repos = "http://cran.rstudio.com")
Aleksandr Blekh
  • 2,462
  • 4
  • 32
  • 64
  • Thanks! I tried suggesting the CRAN mirror explicitly and I still get the warning that:package ‘gains’ is not available (for R version 3.1.2).I've noticed you have the R 3.1.1 version – RodiX Jan 02 '15 at 11:26
  • @RodicaC: I just updated `R` to 3.1.2 on MS Windows and my advice still works fine. Try `install.packages("gains", repos = "http://cran.rstudio.com", type = "source")`. – Aleksandr Blekh Jan 02 '15 at 12:05
  • I've tried the previous advice and I still get the same error... I suppose is something with my R environment, but I don't know what exactly.Thanks! – RodiX Jan 02 '15 at 12:10
  • @RodicaC: Well, in that case re-installing `R` (and, if needed, `RStudio`) might be the easiest way to return your `R` environment back to normal. Give it a try and let us know. You're welcome! – Aleksandr Blekh Jan 02 '15 at 12:30
  • @AleksandrBlekh Seems a little overkill. I think they should try the stuff in the link I have in the comments on the question before nuking R (which I don't think would help in this case). – Dason Jan 02 '15 at 18:25
  • @Dason: Reviewing the error message again, I think that you're most likely right. I hope that your referenced solution will help. – Aleksandr Blekh Jan 02 '15 at 21:45