1

I'm trying to install this removed package in R, but I cannot. Any idea?

https://cran.r-project.org/web/packages/JohnsonDistribution/index.html

The code that I used is the next:

install.packages("~/R/win-library/3.5/johnson.zip", repos = NULL, type = "source")

And the error:

 Warning in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open compressed file 'johnson/DESCRIPTION', probable reason 'No such file or directory'Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :  no se puede abrir la conexión
In R CMD INSTALL 
Warning in install.packages :
  installation of package ‘C:/Users/Angel/Documents/R/win-library/3.5/johnson.zip’ had non-zero exit status

Thanks,

PD: I not asking how I can install in other way, I'm asking how I can install this specific package that gives me an error

Angel Prieto
  • 43
  • 1
  • 7
  • Have you tried the following in RStudio: tools menu -> install packages; in the "install from" drop down, select "Package Archive" then choose the .tar.gz file that's downloaded locally? – NM_ Mar 18 '19 at 17:58
  • yes, i have try this – Angel Prieto Mar 18 '19 at 18:14
  • maybe `devtools::install_version("JohnsonDistribution", version="0.24")`: but you will need compilers installed! – Ben Bolker Mar 18 '19 at 18:35

2 Answers2

1

Using the URL provided, you can install directly with the following:

install.packages("https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz", 
             repos = NULL)

The following should occur

> install.packages("https://cran.r-    project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz", 
+                  repos = NULL)
trying URL 'https://cran.r-    project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.2    4.tar.gz'
Content type 'application/x-gzip' length 7744 bytes
==================================================
downloaded 7744 bytes

* installing *source* package ‘JohnsonDistribution’ ...
** package ‘JohnsonDistribution’ successfully unpacked and MD5 sums checked
** libs
gfortran   -fPIC  -g -O2  -c JohnsonCurve.f -o JohnsonCurve.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined     dynamic_lookup -single_module -multiply_defined suppress -    L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o     JohnsonDistribution.so JohnsonCurve.o -L/usr/local/gfortran/lib/gcc/x86_64-    apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -    F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -    Wl,CoreFoundation
ld: warning: directory not found for option '-    L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
installing to     /Library/Frameworks/R.framework/Versions/3.5/Resources/library/JohnsonDistribution/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (JohnsonDistribution)
NM_
  • 1,887
  • 3
  • 12
  • 27
  • I've the next error: `install.packages("https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz", repos = NULL)` – Angel Prieto Mar 18 '19 at 18:17
  • @AngelPrieto : sorry can you please explain? What error do you get? I will edit my answer to show you what happens when I run this code. – NM_ Mar 18 '19 at 18:20
  • ** package 'JohnsonDistribution' successfully unpacked and MD5 sums checked ** libs *** arch - i386 Warning in system(cmd) : 'make' not found ERROR: compilation failed for package 'JohnsonDistribution' * removing 'C:/Users/Angel/Documents/R/win-library/3.5/JohnsonDistribution' * restoring previous 'C:/Users/Angel/Documents/R/win-library/3.5/JohnsonDistribution' In R CMD INSTALL Warning in install.packages : installation of package ‘C:/Users/Angel/AppData/Local/Temp/RtmpgbP2kz/downloaded_packages/JohnsonDistribution_0.24.tar.gz’ had non-zero exit status – Angel Prieto Mar 18 '19 at 18:31
  • i've anwer with the error. Thanks – Angel Prieto Mar 18 '19 at 18:32
  • @AngelPrieto : try install.packages("devtools") then library(devtools) and try running the code again. – NM_ Mar 18 '19 at 18:41
0

ZIP is not the standard package format. Use the tarball (*.tar.gz) available on CRAN:

https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz

path_to_file = "https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz"
install.packages(path_to_file, repos = NULL, type="source")

Alternatively, if you absolutely need to use that ZIP file, you can repack it from within R, and then use the command above to install the resulting TAR:

unzip("~/R/win-library/3.5/johnson.zip")
shell("R CMD build johnson")
jane
  • 385
  • 1
  • 4
  • 14
  • I've the next error: `I've the next error: install.packages("https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz", repos = NULL)` – Angel Prieto Mar 18 '19 at 18:18