为什么我不能在 RStudio 中安装 "forecast" 包?

Why can't I install "forecast" package in RStudio?

我正在尝试安装 "forecast" 软件包,但在安装时遇到了问题。我尝试了 install.packages("forecast") 并收到此错误消息:

*Installing package into ‘C:/Users/DT217/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
  有二进制版本(将被安装),但源代码版本是后来的:
         binary source
forecast    5.8    5.9
also installing the dependencies ‘zoo’, ‘RcppArmadillo’
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/zoo_1.7-11.zip'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/zoo_1.7-11.zip'
Warning in install.packages :
download of package ‘zoo’ failed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/RcppArmadillo_0.4.600.4.0.zip'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL'http://cran.rstudio.com/bin/windows/contrib/3.1/RcppArmadillo_0.4.600.4.0.zip'
Warning in install.packages :
download of package ‘RcppArmadillo’ failed
trying URL'http://cran.rstudio.com/bin/windows/contrib/3.1/forecast_5.8.zip'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/forecast_5.8.zip'
Warning in install.packages :
download of package ‘forecast’ failed*

我尝试打开报错中给出的URL,打不开。我也尝试安装 "zoo" 包并得到类似的错误。但是,我能够安装一些其他包,所以有些包可以正常工作。

以下是有关我使用的 RStudio 版本的信息:

$platform
[1] "x86_64-w64-mingw32"
$arch
[1] "x86_64"
$os
[1] "mingw32"
$system
[1] "x86_64, mingw32"
$status
[1] ""
$major
[1] "3"
$minor
[1] "1.3"
$year
[1] "2015"
$month
[1] "03"
$day
[1] "09"
$`svn rev`
[1] "67962"
$language
[1] "R"
$version.string
[1] "R version 3.1.3 (2015-03-09)"
$nickname
[1] "Smooth Sidewalk"*

这里有一个 post 有类似的问题。任何帮助将不胜感激。提前致谢!

苏菲

解决您问题的最简单方法是尝试 select 使用不同的 CRAN 镜像来下载和安装 forecast 包。您可以通过选择手动 select 镜像:

Packages -> Set CRAN mirror...

我只是 运行 install.packages("forecast") 使用新加坡镜像(因为我住在那里),我没有问题。

如果您必须继续使用您当前的镜像,那么您将不得不弄清楚哪些依赖项无法下载,您必须从某个地方手动获取它们。

我遇到了同样的问题。命令后:

install.packages("forecast_5.9.tgz")

出现警告: install.packages 中的警告: 包 'forecast_5.9.tgz' 不可用(对于 R 版本 3.1.2)

下面的命令有效

install.packages("forecast") 

还安装了其他相关包。

最佳 Swapnil