Link my package to Rstan >=2.26.6 - how the DESCRIPTION should look like?

I would like to point to rstan 2.26.x

install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

with my R package

https://github.com/stemangiola/ARMET

How would the DESCRIPRTION file look like. At the moment I am using remotes but is failing the github actions. Is there a better way?

Package: ARMET
Version: 0.9.0
Title: Higher-order deconvolution survival analyses
Description: This package performs a joint Bayesian inference of association between deconvoluted cell-tyoe proportions and survival.
Authors@R: person("Stefano", "Mangiola", , "mangiolastefano@gmail.com", c("aut", "cre"))
License: GPL (>=3)
Encoding: UTF-8
LazyData: true
ByteCompile: true
Depends: 
	R (>= 4.0.0), 
	Rcpp (>= 1.0.8.3),
	methods,
	remotes
Imports: 
	rstan (>= 2.26.6),
	rstantools (>= 2.2.0), 
	tidyr (>= 0.8.3.9000), 
	ggplot2,
	tibble,
	data.tree, 
	yaml,
	rlang,
	sirt,
	diptest,
	purrr,
	dplyr,
	tidyr,
	magrittr,
	rlang,
	ape,
	tidybayes,
	tidygraph,
	parallel,
	abind,
	boot,
	ggrepel,
	scales,
	tidybulk,
	gtools,
	xopen,
	stringr
Suggests:
	testthat
Biarch: true
LinkingTo: StanHeaders (>= 2.26.6), rstan (>= 2.26.6), BH (>= 1.66.0), Rcpp (>= 1.0.8.3), RcppEigen (>= 0.3.3.9.2)
SystemRequirements: GNU make
NeedsCompilation: yes
RoxygenNote: 7.2.0
Remotes: stan-dev/rstan@v2.26.6

Thanks

See section 8.1.2 Chapter 8 Package metadata | R Packages

As noted in the link:

You always want to specify a minimum version (dplyr (>= 1.0.0)) rather than an exact version (dplyr (== 1.0.0)). Since R can’t have multiple versions of the same package loaded at the same time, specifying an exact dependency dramatically increases the chance of conflicting versions

Thanks,

yes I have >= for all dependency, is just remotes is pointing necessarily to a unique version, because it is not the main github release.

This is exactly the aspect that I am looking to change. How to point to

https://mc-stan.org/r-packages/

Is still a mystery to me.

Ah, sorry I misunderstood. I thought you wanted an exact version. But it seems like you want to point to a dependency on the Stan website?

If that’s the case maybe find the package on GitHub instead and do this:?Create an R package that depends on another R package located on GitHub - Stack Overflow

Yes that is what I have now. But I would like to not use github but the official repository.

You should use the Additional_repositories: field. See: brms/DESCRIPTION at master · paul-buerkner/brms · GitHub (here it is used for cmdstanr, but its the same thing).

1 Like