Return the version of CmdStan that the instantiate package uses.

stan_cmdstan_version(
  cmdstan_install = Sys.getenv("CMDSTAN_INSTALL", unset = ""),
  error_on_NA = TRUE
)

Arguments

cmdstan_install

Character of length 1, how to look for an installed copy of CmdStan. See https://wlandau.github.io/instantiate/ for details. Choices:

  1. "" (default): look at the original value that the CMDSTAN_INSTALL environment variable contained when instantiate at the time when it was installed. If it was "implicit" or "fixed", then choose the corresponding option below. Otherwise, default to "implicit".

  2. "implicit": Let the cmdstanr::cmdstan_path() decide where to look for CmdStan. As explained in the cmdstanr documentation, the output of cmdstanr::cmdstan_path() depends on the current value of the CMDSTAN environment variable. The cmdstanr package must be installed. If it is not installed, then stan_cmdstan_path() returns the empty string "".

  3. "fixed": Use the path to CmdStan that was originally contained in Sys.getenv("CMDSTAN") at the time when instantiate was installed.

error_on_NA

Logical of length 1, whether an error should be thrown if CmdStan is not found.

Value

Character of length 1, version of CmdStan that the instantiate package uses. If CmdStan is not found, then the return value depends on the error_on_NA argument.

See also

Other cmdstan: stan_cmdstan_exists()

Examples

if (stan_cmdstan_exists()) {
  message(stan_cmdstan_version())
}
#> 2.35.0