简体   繁体   中英

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

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

CRAN removed the "prob" package for R, which several open source probability textbooks depend upon.

  • What I did to solve this:

Another user suggested R 2.9. However,

  • R 2.9 breaks Rstudio,
  • prob isn't actually in the CRAN repository for 2.9, and
  • none of the versions of fAsianOptions available in the archive install for it, anyway. (Already tried all of these.)

Investigating several topic areas in Rdocumentation turned up nothing. 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

Dependencies are listed in the ../prob/DESCRIPTION file (which has no extension but is a simple text file). 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. 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:

install.packages("combinat")

Then when your dependencies are satisfied (and you know where your ../prob -directory is in your filesystem):

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

Here's the solution, thanks to 42- above.

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.

  2. Install the following dependencies: 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

  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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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