Skip to contents

Create Julia environment to simulate stock-and-flow models. use_julia() looks for a Julia installation, and will install Julia as well as some required packages if not found. A Julia environment is created in the inst directory of the sdbuildR package.

Usage

use_julia(
  stop = FALSE,
  version = "latest",
  JULIA_HOME = NULL,
  dir = NULL,
  force = FALSE,
  force_install = FALSE,
  ...
)

Arguments

stop

If TRUE, stop active Julia session. Defaults to FALSE.

version

Julia version. Default is "latest", which will install the most recent stable release.

JULIA_HOME

Path to Julia installation. Defaults to NULL to locate Julia automatically.

dir

Directory to install Julia. Defaults to NULL to use default location.

force

If TRUE, force Julia setup to execute again.

force_install

If TRUE, force Julia installation even if existing version is found. Defaults to FALSE.

...

Optional arguments passed to JuliaCall::julia_setup()

Details

Keep in mind that the installation can take around 5-15 minutes. In every R session, use_julia() needs to be run once (which is done automatically in simulate()), which can take around 20 seconds.

Examples

if (FALSE) {
  # Start Julia session
  # or install Julia and set up environment (first time use)
  use_julia()

  # Stop Julia session
  use_julia(stop = TRUE)
}