A one-time setup helper, in the spirit of usethis's usethis::use_package(),
that declares flexstanr as a dependency of the host package you run it from.
It adds flexstanr to the host's Imports, optionally records a Remotes
entry for a non-CRAN install, and writes a generated re-export file
(R/flexstanr.R) so host::stan_options() keeps resolving and the host's
internal calls to fit_model() / the backend_* accessors are imported.
It does not add a Stan backend: flexstanr requires neither rstan nor cmdstanr,
so the host declares whichever backend it uses.
The re-export file is generated: it carries a do-not-edit banner and is
overwritten on each run, so re-run use_flexstanr() to pick up changes to
flexstanr's re-exported surface. flexstanr resolves the host's own compiled
models automatically from the calling package.
Usage
use_flexstanr(
path = ".",
min_version = NULL,
remote = NULL,
type = "Imports",
reexport = TRUE,
reexport_file = file.path("R", "flexstanr.R")
)Arguments
- path
path to the host package's root (the directory containing its
DESCRIPTION). Defaults to the working directory.- min_version
minimum flexstanr version for the
Importsentry.NULL(the default) pins to the currently-installed flexstanr version; pass a version string to pin explicitly, orFALSEfor no constraint.- remote
optional
owner/repo(or anyremotes-style spec) recorded as aRemotesentry soremotes/pakcan install flexstanr off-CRAN.NULL(the default) records nothing, which is what you want for the CRAN package; pass e.g."ACCIDDA/flexstanr"to install a development build.- type
the
DESCRIPTIONfield flexstanr is added to."Imports"by default, as withusethis::use_package().- reexport
whether to (over)write the generated
R/flexstanr.Rre-export file.TRUEby default; setFALSEto only editDESCRIPTION.- reexport_file
path, relative to
path, of the generated re-export file.