程序包或名称空间加载失败

时间:2019-05-01 00:38:25

标签: r forecasting

我不知道发生了什么,但是每次我调用预测程序包时都会出现此名称空间加载失败。

所以我用了这行代码

install.packages("forecast",repos = c("http://rstudio.org/_packages",
                            "http://cran.rstudio.com"))

这是运行此代码后收到的控制台消息

Installing package into ‘C:/Users/adarsh/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository 
http://rstudio.org/_packages/bin/windows/contrib/3.5:
  cannot open URL 
'http://rstudio.org/_packages/bin/windows/contrib/3.5/PACKAGES'

  There is a binary version available but the
  source version is later:
         binary source needs_compilation
forecast    8.6    8.7              TRUE

  Binaries will be installed
trying URL 
'http://cran.rstudio.com/bin/windows/contrib/3.5/forecast_8.6.zip' 
Content type 'application/zip' length 2345112 bytes (2.2 MB)
downloaded 2.2 MB

package ‘forecast’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\adarsh\AppData\Local\Temp\RtmpQ58pju\downloaded_packages

我检查了其他软件包是否也是这种情况。

install.packages("tseries")


Installing package into ‘C:/Users/adarsh/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘quadprog’ is not available
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/tseries_0.10-46.zip'
Content type 'application/zip' length 414767 bytes (405 KB)
downloaded 405 KB
package ‘tseries’ successfully unpacked and MD5 sums checked**

**The downloaded binary packages are in
    C:\Users\adarsh\AppData\Local\Temp\RtmpQ1vu1H\downloaded_packages**


    library(tseries)


Error: package or namespace load failed for ‘tseries’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘quadprog’
In addition: Warning message:
package ‘tseries’ was built under R version 3.5.3  

再次发生相同的错误。请任何人帮助我。

1 个答案:

答案 0 :(得分:0)

我从 cran存储库下载了“ quadprog ”软件包,并将其另存为zip文件,位于 C:// Users /您的名字/ Documents / package_file。 zip

然后使用R Studio中的选项 Package Archive File(.zip; .tar.gz)并安装了上述软件包。

谢谢