cmdstan_path() returns the full path to the CmdStan installation. The path can be set using the set_cmdstan_path() function. See Details.

cmdstan_path()

set_cmdstan_path(path = NULL)

Arguments

path

The full file path to the CmdStan installation as a string. If NULL (the default) then the path is set to the default path used by install_cmdstan() if it exists.

Value

The file path to the CmdStan installation.

Details

Before the package can be used it needs to know where the CmdStan installation is located. When the package is loaded it tries to help automate this to avoid having to manually set the path every session:

  • If the environment variable "CMDSTAN" exists at load time then its value will be automatically set as the default path to CmdStan for the R session.

  • If no environment variable is found when loaded but the directory ".cmdstanr/cmdstan" exists in the user's home directory (Sys.getenv("HOME"), not the current working directory) then it will be set as the path to CmdStan for the R session. This is the same as the default directory that install_cmdstan() would use to install the latest version of CmdStan.

It is always possible to change the path after loading the package using set_cmdstan_path(path).