安装TTR时如何解决版本问题

时间:2019-06-13 08:29:34

标签: r installation package

我是R编程的新手。想要为TTR​​程序包运行一个小脚本,但出现版本错误

这是我的代码部分

options(repos=(CRAN="https://CRAN.R-project.org/package=TTR"))
install.packages("https://CRAN.R-project.org/package=TTR")

这是我得到的错误

Warning: unable to access index for repository https://CRAN.R-project.org/package=TTR/src/contrib:
cannot open URL 'https://CRAN.R-project.org/package=TTR/src/contrib/PACKAGES'

Warning message: package 'https://CRAN.R-project.org/package=TTR' is not available (for R version 3.4.4) 

Error in library(TTR) : there is no package called 'TTR'

但是当我从https://rdrr.io/snippets/运行TTR库时,它运行良好,并且链接中的R版本为3.4.4

我该如何解决这个问题?

编辑:我看到了这个问题How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?,但是找不到我的解决方案

1 个答案:

答案 0 :(得分:0)

我用您的命令尝试过,但出现相同的错误。但是,将标准方式与install.packages配合使用即可完成工作。

您可以通过以下方式安装软件包:

install.packages('TTR', dependencies=TRUE, repos='http://cran.rstudio.com/')