RStudio想要下载/安装错误的软件包版本

时间:2017-09-20 11:14:08

标签: r rstudio

我想安装软件包“sjlabelled”:

> install.packages("sjlabelled")
Installing package into ‘/home/User/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/sjlabelled_1.0.1.tar.gz'
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/src/contrib/sjlabelled_1.0.1.tar.gz': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/src/contrib/sjlabelled_1.0.1.tar.gz'
Warning in install.packages :
  download of package ‘sjlabelled’ failed

但由于上述错误,此操作失败。在https://cran.rstudio.com/src/contrib/上,你可以看到只有这个软件包的新版本可用(而不是1.0.1有1.0.2 / 1.0.3)。 如何教我的RStudio下载正确的版本?

编辑除了Lyngbakr的接受答案之外,还有一个方便的选项,可以通过工具/安装包/直接在RStudio GUI中进行选择,并选择“从/包存档文件安装(。 tar.gz的)”。然后,在下面的Package archive中,您可以选择下载的文件。然后你只需要点击“安装”。

2 个答案:

答案 0 :(得分:0)

您可以通过devtools::install_github("strengejacke/sjlabelled")

获取最新(开发)版本

答案 1 :(得分:0)

下载该软件包。 尝试:

 install.packages("sjlabelled_1.0.3.zip",lib="/home/User/R/x86_64-pc-linux-gnu-library/3.4",repos=NULL)

如GitHub页面https://github.com/strengejacke/sjlabelled中所述:

library(devtools)
devtools::install_github("strengejacke/sjlabelled") 

以下是安装开发工具包和rtools.exe https://cran.r-project.org/web/packages/devtools/README.html所需的完整参考资料,您只需在Rstudio控制台中输入上面一行并按Enter键