R: Error in install.packages : cannot open the connection
Asked Answered
J

3

3

I was trying to install the package RINDSEL but I am unable to install it and I keep getting the following error:

Error in install.packages : cannot open the connection

I downloaded the package from:

rindsel_1.0_2.zip | Integrated Breeding Platform

and loaded it from the directory. Other packages from the directory can be installed but just not this one.

Is the package corrupt or could there be any other error?

I would really be grateful for any help. Thanks in advance

Joinder answered 13/2, 2018 at 8:48 Comment(6)
Have you downloaded it's dependence? Have you specified install from your directory in install.packages? By default it tries to install from internet.Kanara
The instructions only state : 1. Packages lme4 and Hmisc have to be installed from the menu 2. Packages select install package(s) from the local zip file. I did both but still, I am unable to install it.Joinder
Could you provide any error message?Gyimah
Or try install.packages(file.choose(), repos = NULL, type = "win.binary"), unzip first.Gyimah
I am unable to select the entire package folder using this procedure. It asks me select one file at a time. The error message : Warning in install.packages : cannot open compressed file 'rindsel_1.0/DESCRIPTION', probable reason 'No such file or directory' Error in install.packages : cannot open the connectionJoinder
These are the contents of the discription file: Package: Rindsel Type: Package Title: Phenotypic and molecular selection indices Version: 1.0 Date: 2011-10-11 Author: Sergio Pérez-Elizalde and Jose Crossa Maintainer: Sergio Pérez-Elizalde <[email protected]> Description: Functions for molecular and phenotypic selection indices commonly used in plant breeding License: GPL (>= 2) Depends: Hmisc, lme4 LazyLoad: yes Built: R 2.13.1; ; 2011-11-08 05:28:18 UTC; windowsJoinder
M
4

Rename the zip file RinSel Software into Rindsel. That's the name specified in the discription file.

Then, you can install the package in R with the command

install.packages("C:/path/to/Rindsel.zip",repos=NULL,type="win.binary")

That works fine... at first (!!!).

Problem with the Rindsel package is. It is quite old. It was build with R 2.13.1. Therefore, if you want to load the library which would be the next step to use the package in R you will get the error:

Problems building package (Error: "package has been build before R-3.0.0")

My suggestion: Contact the authors of the package and ask them if they can either provide the source file that you can build the package by yourself or if they can bundle the Rindsel package with a newer R version.

(Or you could try to hunt down an old R version and see if you can get the thing running with an old R... However, I would not seriously suggest to do that. It would probably result in conflicting dependencies with the other required packages...)

EDIT 15-02-2018: OP asked if one can build an R package with sources that are presumeably the Rindsel source files.

Yes, basically, you could do that. You would have to make a your own description and namespace file and put the source file in the R folder than invoke the command in R to build it....

But it's not neccessary with the script files provided by the link the OP posted.

OP, just run the scripts in R! It's quite easy.

  1. Download the zip-file and extract it on your machine.
  2. Go to that directory. The R command would be

setwd('path/to/your/directory')

  1. Than run the R script, e.g, the KNIndex.r. It's simple:

source('KNIndex.r')

Then the script will run and produce some output / prompts.

Misquotation answered 13/2, 2018 at 13:40 Comment(4)
Thanks very much for the help. I did download the code for rindsel using this link (data.cimmyt.org/dataset.xhtml?persistentId=hdl:11529/10352) but I have no idea how an R package is built.Joinder
SelIndices.zip? That's no R package. It's just a collection of R-files. Unzip this archive and open the files in R or R-Studio. For SelIndices.zip you don't need to build a package. As far as I see it, that's another thing than this Rindsel.Misquotation
Yes, Rindsel essentially calculates selection index only and therefore I believe it might be the r code for Rindsel. Can a package not be made from this r code from SelIndices.zip?Joinder
You don't need a R package to run the source files in SelIndices.zip... See my edited answer...Misquotation
B
1

For future readers, I was able to fix the error by running RStudio with administrative privileges to get the command to work.

If that does not fix it, you might wish to try

  • Installing "r tools" if that is not installed already. That can be downloaded from https://cran.r-project.org/bin/windows/Rtools/
  • Download a relevant package that you are trying to install (e.g., tidyverse_1.3.0.zip) from https://cran.rstudio.com/
  • and install that from local path
  • It can also be installed directly from the web using install.packages("https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip")
Barbary answered 9/12, 2020 at 15:44 Comment(0)
N
1

I had the same problem. R was not able to extract and compile the package files to the default installation directory for some system-specific reasons (not R related). I was able to fix this by specifying the installation directory of the package lib using:

install.packages("your package", lib = 'path/to your/required/installation/directory')

You can then load the package by specifying the lib.loc option while loading it:

library('your package', lib.loc='path/to your/required/installation/directory')

A better solution:

Create a new environment variable (if you are using windows) R_LIBS_USER with the following directory path/to your/required/installation/directory. This will change the default installation directory of the packages and make it easier to load and install them without specifying the location everytime.

Necrology answered 25/10, 2021 at 10:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.