-1

I just tried to download the R packages for my working computer but I run into issues when using install.packages():

install.packages("dplyr")

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'

I also tried to install the package by hand myself, downloading it from CRAN website, unzipping it, and moving it into the library folder. This time the errors shows :

‘dplyr’ is not a valid installed package

Does anyone know how to deal with that? Thanks a lot!

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
DJJKZ
  • 175
  • 12
  • `utils::install.packages("packageName", dependencies=TRUE, repos='http://cran.rstudio.com/')` works? – Andre Elrico Sep 04 '18 at 11:28
  • 1
    if that does not work your probably sitting behind a `proxy` so [CLICK HERE](https://www.google.de/search?q=r+install.packages+proxy&rlz=1C1CHBD_deDE736DE736&oq=r+install.packages+proxy+&aqs=chrome..69i57j0l5.11991j0j4&sourceid=chrome&ie=UTF-8) – Andre Elrico Sep 04 '18 at 11:30
  • no, it still shows the same error – DJJKZ Sep 04 '18 at 11:30
  • If everything does not work, you can always download packages and install them "by hand". – Andre Elrico Sep 04 '18 at 11:31
  • Yes, I tried to install dplyr by hand, but it still shows the erro that: Error in library(dplyr) : ‘dplyr’ is not a valid installed package – DJJKZ Sep 04 '18 at 11:35
  • can you use `download.file` or do you have the same issue ? At work for some reason I can use `install.packages` but not `download.file`, so I devised a custom function to use commandline and the `bitsadmin` tool, I can share it if it's relevant for you (windows only obviously) – moodymudskipper Sep 04 '18 at 11:36
  • @Runsang Yu you should detail in your question the exact steps that you tried, and give your session into and operating system. Also, try to reproduce the issue in your R console (no Rstudio), report the result in your post, and if the issue remains without Rstudio, remove the tag – moodymudskipper Sep 04 '18 at 11:39
  • I am sorry if I do not make it clear. Here's the situation: When I input: install.packages(dplyr), it shows the error that: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' and I am not sure whether this comes out because of the company firewall. Then I try to install the package by hand myself, downloading it from CRAN website, unzipping it, and moving it into the library folder. This time the errors shows to be "‘dplyr’ is not a valid installed package – DJJKZ Sep 04 '18 at 11:57
  • 1
    Talk to your IT department? – John Coleman Sep 04 '18 at 12:09
  • 1
    This is not how you install "manually" a package, this should work: download it as you did, then Tools/install packages in RStudio . The info you gave should be in your question, not comments. – moodymudskipper Sep 04 '18 at 12:15
  • Thanks for that. I install packages manually to Rstudio. However, it shows the error that :ERROR: dependencies 'assertthat', 'bindrcpp', 'glue', 'magrittr', 'pkgconfig', 'R6', 'Rcpp', 'rlang', 'tibble', 'tidyselect', 'BH', 'plogr' are not available for package 'dplyr'. Does that mean I also should install them one by one manually? – DJJKZ Sep 04 '18 at 12:23
  • yes unfortunately... I have a script that gives you an order of installation but I didn't upload it to github and don't have it with me, I'll try to see a bit later if it's ready to share. These packages might themselves require some other packages that you don't have, so get ready to have fun. – moodymudskipper Sep 04 '18 at 12:52
  • Consider @John Coleman's comment though – moodymudskipper Sep 04 '18 at 12:55
  • Yes, thanks for telling me this! I think I have solved this problem through downloading the Microsoft R Application Network. – DJJKZ Sep 04 '18 at 13:13
  • Congratulations :). Consider answering your own question so next users can benefit – moodymudskipper Sep 04 '18 at 13:15

1 Answers1

1

Just to post answers for those who meet the same situations as me: https://mran.microsoft.com/download download the Microsoft R Application Network instead of the R version from official website. and the packages can be downloaded successfully!

DJJKZ
  • 175
  • 12