caldwellst
caldwellst

Reputation: 5956

Non-standard Remotes package INLA in R package

I have a package that Requires INLA, which is not hosted on CRAN or a standard GitHub repository. There are multiple SO questions detailing how to install the package on a personal machine, such as this, or even mentions it as a dependency in a package.

The two ways that are typically recommended to install on a personal machine are:

Direct from INLA website

install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

From the GitHub host

devtools::install_github(repo = "https://github.com/hrue/r-inla", ref = "stable", subdir = "rinla", build = FALSE)

Now, these are fine for personal machines, but don't work in the DESCRIPTION files Remotes: section.

If we do url::https://inla.r-inla-download.org/R/stable, this gives an error that the file extension isn't recognized.

 Error: Error: Failed to install 'unknown package' from URL:
  Don't know how to decompress files with extension 

If we do github::hrue/r-inla, I am unaware of how to pass (or if it's even possible) the ref, subdir, and build arguments in the DESCRIPTION file.

Previous packages used a read only mirror of the INLA code that was hosted on GitHub, solely for this purpose, at this repo and then just using github::inbo/INLA. However, this repository is out of date.

Current solution

What I'm doing instead is to directly reference the tarball hosted on the main webpage.

url::https://inla.r-inla-download.org/R/stable/src/contrib/INLA_21.02.23.tar.gz

This solution works, and passes CI as well as the machines are able to install and load from there. The only issue is that I need to periodically update the static link to this tarball, and would prefer to reference the stable build, either directly from the INLA website as above, or the hrue/inla repo with those other arguments passed. Directly referencing those links also has the advantage that when my package is re-installed on a machine, it would recognize whether or not the latest version of INLA has been installed on that machine. Is there a way to achieve this in the DESCRIPTION file?

Upvotes: 2

Views: 728

Answers (2)

oxidising
oxidising

Reputation: 310

You can do this by adding the following line to your DESCRIPTION file.

Additional_repositories: https://inla.r-inla-download.org/R/stable

Upvotes: 1

Shawn Brar
Shawn Brar

Reputation: 1420

This is not a perfect answer but maybe what you can do is add the zip url of the stable branch of INLA from the new github repository of INLA:-

url::https://github.com/hrue/r-inla/archive/refs/heads/stable.zip

Hence, this will always install the latest stable version of the package.

Upvotes: 4

Related Questions