How to install the KriSp package in R?

3

I want to install the following package in the link

It is in tar.gz format

I used the following command:

  

install.packages ("~ / KriSp_0.4.tar.gz", repos = NULL, type="source")

When I try to install it, the following message appears:

  

Warning: invalid package

     

Error: ERROR: no packages specified

     

Warning in install.packages

    
asked by anonymous 28.04.2015 / 17:00

2 answers

1

To install this package the easiest way is to use devtools .

Install devtools using install.packages("devtools") . On Windows, devtools also asks you to install RTools which is not a package, but another program: link

KriSp seems to have been made in earlier versions of R and does not have a NAMESPACE file in its source code. Therefore, you need to unpack the code, and add that file to the folder. I unzipped using 7zip and then created a copy of the DESCRIPTION file, changed the name to NAMESPACE and deleted the content.

Then using the command:

devtools::install_local("caminho para a pasta com o codigo fonte")

Example:

devtools::install_local("C:/Users/daniel/Desktop/KriSp_0.4.tar/KriSp_0.4/KriSp/")

You should be able to install the package.

    
28.04.2015 / 18:49
0

An alternative response to Daniel, without using devtools .

First you have to install the dependencies of the package (the other packages that% depends on):

install.packages(c("fields","SparseM"), repos = "http://cran.r-project.org")

Then you download the file and have it installed as type KriSp because it is not in binary format:

install.packages("KriSp_0.4.tar.gz", repos = NULL, type = "source")

However, as Daniel said, since this package was made at a time when there was no NAMESPACE, if you try this on recent versions of R it will have problems.

NAMESPACE, roughly speaking, says which functions you will export to the user in the global environment, what functions will you not export, what packages or functions of other packages will you import etc . Then you can do the following: unpack the KriSp folder from within the tar and create a simple text file called NAMESPACE with the following content.

exportPattern("^[^\.]")

You are basically having to export all functions that do not start with dot. Now you just have to install by source again, but this time putting the name of the folder and not the name of the tar.

install.packages("KriSp", repos = NULL, type = "source")

I just tested here and it worked. However, just because it is installed does not mean that it is ok, so it is worth noting that this package may be full of compatibility issues, since it has not been maintained for a long time.

    
29.04.2015 / 17:57