代码之家  ›  专栏  ›  技术社区  ›  user366312

如何安装R的readxl包?

  •  0
  • user366312  · 技术社区  · 6 年前

    我正在尝试安装 读XL

    以下是RStudio输出:

    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'
    > 
    

    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) 
    > 
    

    我如何解决这个问题?

    0 回复  |  直到 6 年前
        1
  •  1
  •   Justin Stone    6 年前

    错误消息似乎明确地告诉您,R无法连接以下载包。以下是一些想法:

    • 您的用户配置文件是否具有管理权限?我不是一个庞大的Windows用户,但你在技术上试图添加软件,这有时需要升级权限。也许尝试在windows中以管理员身份运行R,看看这是否是问题所在。(似乎不大可能。)
    • 如果是防火墙问题,您可以尝试为R和/或Cran存储库的防火墙设置添加一个例外。
    • 你有没有试过解释依赖包?安装.packages(“readxl”,dependencies=TRUE)(这也会导致自身的问题,因此请考虑预先警告自己。)
    推荐文章