Have trouble installing ggExtra in RStudio

时间:2018-02-03 10:19:53

标签: r ggplot2

When I try to library "ggExtra" in RStudio with code below:

    install.packages("ggExtra")

what displayed is:

    Warning in install.packages :
    unable to access index for repository 
    https://cran.rstudio.com/src/contrib:
    cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
    Warning in install.packages :
    unable to access index for repository 
    http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
    cannot open URL 
    'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
    Installing package into ‘C:/Users/Kyrie NI/Documents/R/win-library/3.4’
     (as ‘lib’ is unspecified)

I also tried:

    install.packages("devtools")
    devtools::install_github("daattali/ggExtra")

And I received the same results. What is wrong with my operation, or the package?

1 个答案:

答案 0 :(得分:1)

我在使用R 3.5.0时遇到了类似的问题,并且发现了一个在线解决方案,其工作方式如下。似乎我需要通过添加第一行来设置默认的CRAN镜像。然后,我将我的R更新到版本3.5.1,以便能够对其进行存储。希望对您也有帮助。

   options(repos = c(CRAN = "http://cran.rstudio.com"))
    install.packages("ggExtra")

最初的想法来自: https://support.rstudio.com/hc/en-us/community/posts/205198138-packages-installation-problem