简体   繁体   English

R“问题”软件包未安装-依赖项失败

[英]R “prob” package doesn't install - failing dependencies

  • R version 3.4.2, R版本3.4.2,
  • RStudio 1.1.383, RStudio 1.1.383,
  • Windows 10 Windows 10

CRAN removed the "prob" package for R, which several open source probability textbooks depend upon. CRAN删除了R的“问题”程序包,这是几本开源概率教科书所依赖的。

  • What I did to solve this: 我为解决这个问题所做的工作:

Another user suggested R 2.9. 另一个用户建议使用R 2.9。 However, 然而,

  • R 2.9 breaks Rstudio, R 2.9打破了Rstudio,
  • prob isn't actually in the CRAN repository for 2.9, and Prob实际上不在2.9的CRAN存储库中,并且
  • none of the versions of fAsianOptions available in the archive install for it, anyway. 无论如何,归档文件中都没有安装fAsianOptions的版本。 (Already tried all of these.) (已经尝试了所有这些方法。)

Investigating several topic areas in Rdocumentation turned up nothing. 研究Rdocumentation中的几个主题区域并没有发现任何问题。 This used to be a popular package and other works were written that depend upon it. 这曾经是一个很受欢迎的软件包,其他依赖它的著作也被编写出来。 Now that it is broken/gone, what is the workaround? 现在它已损坏/消失了,解决方法是什么?

Install dependencies first. 首先安装依赖项。

install.packages("installr")  # Not appropriate for Macs
library(installr)
install.Rtools()

Download the latest fAsianOptions...tar.gz from the Archives 从档案中下载最新的fAsianOptions ... tar.gz

Dependencies are listed in the ../prob/DESCRIPTION file (which has no extension but is a simple text file). 依赖关系列在../prob/DESCRIPTION文件(无扩展名,但是简单的文本文件)中。 If these are all installed then: 如果所有这些都已安装,则:

install.packages("~/Downloads/fAsianOptions", repo=NULL,type="source")

That does need compilation so you needed to have the proper development tools for Windows. 那确实需要编译,因此您需要具有适用于Windows的正确开发工具。 Note that it, too, has dependencies, so install them as well: 请注意,它也具有依赖项,因此也请安装它们:

 # In the DESCRIPTION file for fAsianOptions you read ->
 #  Depends: R (>= 2.4.0), timeDate, timeSeries, fBasics, fOptions

 # If you had not installed all the dependnecies you would need:

 install.packages("~/Downloads/fAsianOptions", dependencies=TRUE, 
                  repo=NULL, type="source")

The combinat package can be installed from CRAN: 可以从CRAN安装combinat软件包:

install.packages("combinat")

Then when your dependencies are satisfied (and you know where your ../prob -directory is in your filesystem): 然后,当您的依赖关系得到满足(并且您知道../prob在文件系统中的位置)时:

install.packages("~/Downloads/prob", repo=NULL,type="source")
# obviously something else should be substituted for `~/Downloads/`

Here's the solution, thanks to 42- above. 这是解决方案,这要感谢42-。

So, for others who might encounter this same situation: 因此,对于可能遇到相同情况的其他人:

  1. Install RTools from here: https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe Trying to install Rtools from inside RStudio will result in an "it's not available for 3.4.2" message. 从此处安装RTools: https ://cran.r-project.org/bin/windows/Rtools/Rtools34.exe尝试从RStudio内部安装Rtools会导致“不适用于3.4.2”消息。

  2. Install the following dependencies: timeDate, timeSeries, fBasics, fOptions 安装以下依赖项:timeDate,timeSeries,fBasics,fOptions

  3. Download fAsianOptions from here: https://cran.r-project.org/src/contrib/Archive/fAsianOptions/fAsianOptions_3010.79.tar.gz and prob from here: https://cran.r-project.org/src/contrib/Archive/prob/prob_1.0-0.tar.gz 从这里下载fAsianOptions: https://cran.r-project.org/src/contrib/Archive/fAsianOptions/fAsianOptions_3010.79.tar.gz从这里概率: https://cran.r-project.org/src /contrib/Archive/prob/prob_1.0-0.tar.gz

  4. Unzip each into its own directory. 将每个解压缩到其自己的目录中。

  5. Use this to install each, as appropriate: install.packages("~/Downloads/fAsianOptions", dependencies=TRUE, repos=NULL, type = "source") 使用它来适当地安装每个组件:install.packages(“〜/ Downloads / fAsianOptions”,dependency = TRUE,repos = NULL,类型=“ source”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM